continue to implement news tpl files

This commit is contained in:
Dennis Eichhorn 2020-10-25 23:08:37 +01:00
parent c79c019f3e
commit 17806c2667
4 changed files with 7 additions and 8 deletions

View File

@ -45,7 +45,7 @@ echo $this->getData('nav')->render(); ?>
<tr tabindex="0" data-href="<?= $url; ?>"> <tr tabindex="0" data-href="<?= $url; ?>">
<td><span class="tag <?= $this->printHtml($color); ?>"><?= $this->getHtml('TYPE' . $news->getType()); ?></span></a> <td><span class="tag <?= $this->printHtml($color); ?>"><?= $this->getHtml('TYPE' . $news->getType()); ?></span></a>
<td><a href="<?= $url; ?>"><?= $this->printHtml($news->getTitle()); ?></a> <td><a href="<?= $url; ?>"><?= $this->printHtml($news->getTitle()); ?></a>
<td><a href="<?= $url; ?>"><?= $this->printHtml($news->getCreatedBy()->getName1()); ?></a> <td><a href="<?= $url; ?>"><?= $this->printHtml($news->getCreatedBy()->getName2() . ', ' . $news->getCreatedBy()->getName1()); ?></a>
<td><a href="<?= $url; ?>"><?= $this->printHtml($news->getPublish()->format('Y-m-d')); ?></a> <td><a href="<?= $url; ?>"><?= $this->printHtml($news->getPublish()->format('Y-m-d')); ?></a>
<?php endforeach; ?> <?php endforeach; ?>
<?php if ($count === 0) : ?> <?php if ($count === 0) : ?>

View File

@ -13,6 +13,7 @@
declare(strict_types=1); declare(strict_types=1);
use \phpOMS\Uri\UriFactory; use \phpOMS\Uri\UriFactory;
use phpOMS\Utils\Parser\Markdown\Markdown;
/** @var \phpOMS\Views\View $this */ /** @var \phpOMS\Views\View $this */
/** @var \Modules\News\Models\NewsArticle[] $newsList */ /** @var \Modules\News\Models\NewsArticle[] $newsList */
@ -30,7 +31,7 @@ echo $this->getData('nav')->render(); ?>
<div class="portlet-head"><a href="<?= $url; ?>"><?= $this->printHtml($news->getTitle()); ?></a></div> <div class="portlet-head"><a href="<?= $url; ?>"><?= $this->printHtml($news->getTitle()); ?></a></div>
<div class="portlet-body"> <div class="portlet-body">
<article> <article>
<?= \substr($news->getContent(), 0, 500) . (\strlen($news->getContent()) > 500 ? '...' : ''); ?> <?= Markdown::parse(\substr($news->getPlain(), 0, 500)); ?>
</article> </article>
</div> </div>
<div class="portlet-foot"> <div class="portlet-foot">

View File

@ -45,7 +45,7 @@ echo $this->getData('nav')->render(); ?>
<tr tabindex="0" data-href="<?= $url; ?>"> <tr tabindex="0" data-href="<?= $url; ?>">
<td><span class="tag <?= $this->printHtml($color); ?>"><?= $this->getHtml('TYPE' . $news->getType()); ?></span></a> <td><span class="tag <?= $this->printHtml($color); ?>"><?= $this->getHtml('TYPE' . $news->getType()); ?></span></a>
<td><a href="<?= $url; ?>"><?= $this->printHtml($news->getTitle()); ?></a> <td><a href="<?= $url; ?>"><?= $this->printHtml($news->getTitle()); ?></a>
<td><a href="<?= $url; ?>"><?= $this->printHtml($news->getCreatedBy()->getName1()); ?></a> <td><a href="<?= $url; ?>"><?= $this->printHtml($news->getCreatedBy()->getName2() . ', ' . $news->getCreatedBy()->getName1()); ?></a>
<td><a href="<?= $url; ?>"><?= $this->printHtml($news->getPublish()->format('Y-m-d')); ?></a> <td><a href="<?= $url; ?>"><?= $this->printHtml($news->getPublish()->format('Y-m-d')); ?></a>
<?php endforeach; ?> <?php endforeach; ?>
<?php if ($count === 0) : ?> <?php if ($count === 0) : ?>

View File

@ -57,8 +57,6 @@ echo $this->getData('nav')->render(); ?>
$commentList = $news->getComments(); $commentList = $news->getComments();
if (!empty($commentList) && $commentList->isActive()) : if (!empty($commentList) && $commentList->isActive()) :
/* @todo: check if user has permission to create a comment here, maybe he is only allowed to read comments */ /* @todo: check if user has permission to create a comment here, maybe he is only allowed to read comments */
/* @todo: instead of creating a custom news list or news textarea I should create a component which simply gets loaded on the pages by passing the commentList id and the comments to show */ echo $this->getData('commentCreate')->render(1);
$this->getData('commentCreate')->render(1); echo $this->getData('commentList')->render($commentList);
$this->getData('commentList')->render(1);
endif; ?> endif; ?>