3 times a blog. How to make 3 pages with 3 sections dynamic?

Sorry, stupid error. Should be $infos

foreach ($infos as $info): ?>

Ok, but how do I beam all of the entries for infos, news and gotchas on a listing page for each of them?

I started with a template for the listing page for “infos” for Bananas, which is basically a copy of the other one (gegenseite.php), but with a limit to 30. No snippet for it, because it gets the content from the snippets for infos, news, gotchas just as with gegenseite.php.

I have a blueprint for the listing page which points to the template of that listing page.

What is your intended structure? So you want to have listing for banana-info, banana-news etc, guava-infos, guave-news etc.? In that case, maybe the current structure doesn’t even make sense because we end up with unnecessary folders. Or at least I would change the structure I think.

Oh shoot.

So, yes. Additional to the 3 main fruit pages where I only display teaser oder excerpts or just some sort of preview, I wanted to offer pages where all infos and news are available.

The listing pages should contain all infos and news. And the listing page for Gotchas should contain fotos aka figure elements plus some additional text elements.

Still don’t quite get it. Should the listings contain both infos and news in one listing? Plus a separate listing for gotchas? Or three different listings, news, infos and gotchas? But why create separate pages when we already have these infos, news and listings pages? That’s where my brain starts wreaking havoc.

Or did I miss something?

This.

Maybe I got this wrong, but does this mean you started creating additional pages? when we already have them?

E.g you already have a page uber/infos, so imo this should list all infos.

Äh, right. So I could use that and just dont’t limit the output, right?

Yep!

So, I use a template for that listing put a loop in there that gets all content from that content folder/ 1_uber/ infos. Right?

This would be the regular loop from the blog example in the docs, right?

No need for yamls and snippets, right?

Right, no yamls, not snippets, just the templates (infos.php, news.php and gotchas.php). Although, to keep your code clean, you could reuse the snippets that list your 3 infos etc. in the gegenseite templates, only with the modifications I proposed above.

This is the loop I use in that template for that new listing page:

     <?php foreach($page->children()->listed()->flip() as $info): ?>

  <article>
    <h1><?= $info->title()->html() ?></h1>
    <p><?= $info->text() ?></p>
    <a href="<?= $info->url() ?>">Read more…</a>
  </article>

  <?php endforeach ?>

But I can’t tell uber/infos to use that new template.

In the infos.yml I added that tempalte so I can choose it in the panel but that gives me a new subpages

What is the filename of that template?

uber-infos.php

Since the content file name is infos.txt, the template must also be called infos.php. Unless you have renamed my files, that is. But that wouldn’t make sense. You do not want three different infos pages with three different templates and blueprints.

infos.yml blueprint    => infos.txt text file   => infos.php template
news.yml blueprint      => news.txt text file       => news.php template
etc.

IT WWWOOOOOOOOOOOOOOOOOOOOOOOOOOOO Hechel Hechel OOOOOOOOOOOOOOOOOOOOOOOOORRRRRRRRRRRKKKKKKKSSSSSSSSSSS

tldr:

it works

Yay :tada:

Congratulation to getting your Kirby 3 site up and running fine now :slight_smile: ! I’ve followed this thread all time and I was eager to hear this success message, hehe!

Thank you!

This was really difficult and maybe a good example of the difficulties in communicating what is in your mind. This can be quite different depending on how you think and how you use language to explain that.

I really admire brains like Sonjas who can think like that. We talked about that a bit in privat (and in Görman) and my point is the difference between visually “thinking” humans like me and thinky thinking people like her.

Because a yml file and a txt file look the same - except for their file extensions - its actually a little hard to really differentiate between them and so understand there function in a snap. Like one should.

Plus: In a project phase where people like me quickly get into a survival mode with a “tunnel view”, you don’t see(!) anything anymore. In some situations a was editing the wrong files and didn’t see which one it actually was.

I guess a one point in the middle I probably but a loop into a loop without seeing it.

Plus plus: Singular and plurals! Its “infos” stupid, not “info”. Or the other way around.

But the moment when I made my first loop ever and it worked - although giving back the wrong content - it was fantastic! It did something!

1 Like