Tytuł listy stron
<?php if (isset($pageListTitle) && $pageListTitle) { ?> <?php echo h($pageListTitle) ?> <?php } ?>
Tytuł strony
$title = $th->entities($page->getCollectionName());
Miniaturka
<?php $thumbnail = $page->getAttribute('thumbnail'); if (is_object($thumbnail)) { $imgVersion = $thumbnail->getVersion(); $thumbnailURL = $imgVersion->getThumbnailURL('post_image'); ?> <img alt="" src="<?= $thumbnailURL ?>" /> <?php } ?>
Miniaturka (atrybut "thumbnail"). Typem thumbnail jest "Post image" z handlerem "post_image":
Data opublikowania strony (postu):
$dh = Core::make('helper/date'); $date = $dh->formatDate($page->getCollectionDatePublic(), true);
Funkcje przydatne przy formatowaniu daty:
formatDate($value = 'now', $format = 'short', $toTimezone = 'user')
gdzie:
$format: short (default), full, long
short: 09.04.2020
full: czwartek, 9 kwietnia 2020
long: 9 kwietnia 2020
Inne funkcje:
formatDateTime($value = 'now', $longDate = false, $withSeconds = false, $toTimezone = 'user')
formatPrettyDate($value, $longDate = false, $toTimezone = 'user')
function formatPrettyDateTime($value, $longDate = false, $withSeconds = false, $timezone = 'user')
function formatCustom($format, $value = 'now', $toTimezone = 'user', $fromTimezone = 'system')
Link do dokumentacji:
Krótki opis
$th = Core::make('helper/text'); $description = $page->getCollectionDescription(); $description = $controller->truncateSummaries ? $th->wordSafeShortText($description, $controller->truncateChars) : $description; $description = $th->entities($description);
Kod wstawiający krótki opis do listy postów
Lnk do strony (postu)
if ($page->getCollectionPointerExternalLink() != '') { $url = $page->getCollectionPointerExternalLink(); if ($page->openCollectionPointerExternalLinkInNewWindow()) { $target = '_blank'; } } else { url = $page->getCollectionLink(); $target = $page->getAttribute('nav_target'); } $target = empty($target) ? '_self' : $target;
Ostatni edytor
$last_edited_by = $page->getVersionObject()->getVersionAuthorUserName();
Wyświetlanie nazwy twórcy strony
$page_owner = UserInfo::getByID($page->getCollectionUserID()); if (is_object($page_owner)) { echo $page_owner->getUserDisplayName(); }
Avatar - właściciela wpisu
if ($page_owner->hasAvatar()) { $avatar = $page_owner->getUserAvatar(); $avatar_path = $avatar->getPath(); }