No, thatās a misunderstanding. It has been said āinside the loopā, hence it should look like
<?php foreach($page->children()->listed()->flip() as $article): ?>
<article>
<?= $article->text()->kirbytext() ?>
<time><?= $article->published()->toDate('d.m.Y') ?></time>
</article>
<?php endforeach ?>
Thank you for the clarification, Iām new to PHP.
I modified the code as you put it, but Iām still not getting my test entry to show up.
In your default.php template, before you call the article snippet, please do a
<?php dump($page->children()->listed()) ?>
In terms of getting the test post to display, that technically worked. However, now my CSS seems to be broken, so itās just a white unstyled page with elements from the Starterkit theme showing up on the page that previously were not showing up (Starterkitās favicons in my navbar, the āMade with Kirbyā footer and its links, etc.)
Iām also seeing this bit of code in the space above where my test post displays:
Kirby\Cms\Pages Object
(
[0] => home/test-post-1
)
I definitely need to go through the folders and delete the rest of the Starterkit stuff that I donāt want or need, but Iām not sure if thatāll fix the CSS not working. Iāll also look into seeing if I can download the blank theme through CPanel in case itās easier to just save my files Iāve made so far and start the site again from scratch.
If you have other tips or suggestions, Iām all ears.
P.S. - default.php currently looks like this:
<?php snippet('header') ?>
<main>
<?php dump($page->children()->listed()) ?>
<?php snippet('article') ?>
</main>
<?php snippet('footer') ?>
</body>
</html>
Thatās the result of the dump()
code, this shows that there is one page. Was just to debug, so you can remove it again.
Some tips:
- Set up a development environment locally instead of working on a remote server
- Maybe start from a clean slate (Plainkit) rather than the Starterkit
- Learn simple debugging techniques for the PHP code (Debugging | Kirby CMS)
- Do an entry level PHP tutorial (data types, control structures etc.), it really helps