Bagaimana cara menampilkan dateModified di Mecha CMS? #290
Answered
by
taufik-nurrohman
bungfrangki
asked this question in
Q&A
-
Mas, kalau mau manggil dateModified dengan format seperti ini |
Beta Was this translation helpful? Give feedback.
Answered by
taufik-nurrohman
Aug 10, 2024
Replies: 2 comments 4 replies
-
Tambahkan ini di // Buat metode `dateModified`
Page::_('dateModified', function ($mod = null) {
if (!$this->_exist) {
return new Time($mod); // Berkas tidak eksis
}
$mod = filemtime($this->path);
return new Time($mod);
}); Kemudian di berkas layout bisa dipanggil seperti ini: <?= eat($page->dateModified->format('c')); ?> |
Beta Was this translation helpful? Give feedback.
3 replies
Answer selected by
bungfrangki
-
Sudah ketemu masalahnya mas, karena kurang nilai default pada argumen metode. Di sini Saya mengeset nilai default menjadi Page::_('dateModified', function ($mod = null) {}); |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Tambahkan ini di
.\lot\y\*\index.php
:Kemudian di berkas layout bisa dipanggil seperti ini: