1 | <?php |
||
2 | /** @var \Apps\ActiveRecord\Content[] $records */ |
||
3 | |||
4 | use Ffcms\Core\Helper\Date; |
||
5 | use Ffcms\Core\Helper\Text; |
||
6 | use Ffcms\Core\Helper\Type\Str; |
||
7 | |||
8 | foreach ($records as $record) { |
||
9 | $title = \App::$Translate->getLocaleText($record->title); |
||
10 | if (Str::likeEmpty($title)) { |
||
11 | continue; |
||
12 | } |
||
13 | $title = Text::snippet($title, 50); |
||
14 | $date = Date::humanize($record->created_at); |
||
15 | $categoryUrl = \App::$Alias->baseUrl . '/content/list/' . $record->cpath; |
||
0 ignored issues
–
show
Bug
introduced
by
Loading history...
|
|||
16 | $categoryLink = '<a href="' . $categoryUrl . '">' . \App::$Translate->getLocaleText($record->ctitle) . '</a>'; |
||
0 ignored issues
–
show
|
|||
17 | $newsLink = \App::$Alias->baseUrl . '/content/read/' . $record->cpath; |
||
18 | $newsLink = rtrim($newsLink, '/') . '/' . $record->path; |
||
19 | |||
20 | echo '<div class="row"><div class="col-md-12">'; |
||
21 | echo '<a href="' . $newsLink . '">→ ' . $title . '</a><br />'; |
||
22 | echo '<small class="float-left">' . $categoryLink . '</small>'; |
||
23 | echo '<small class="float-right text-secondary">' . $date . '</small>'; |
||
24 | echo '</div></div>'; |
||
25 | echo '<hr class="pretty" />'; |
||
26 | } |
||
27 | ?> |