I have an extremely newbie question. The answer is probably even in the documentation, but I can’t find it.
So, here’s what I need:
I have a page called ‘home’ which contains a page called ‘countdown’.
Now, I want to get the uid (actually the content, but that’s not the problem) of this ‘countdown’ page and display it on the home page. But how?
I tried various things (inside the countdown.php snippet) like
A small tip for you:
If the uid of the page changes, your code would break the whole page. The function would not find the “countdown” page, display an error and stop rendering the rest of the page.
Especially if you’ve got clients that edit the website this could save you some trouble. You can even define a fallback or display a warning message in an “else” part:
For the record your first tests didn’t work because the path of your page is home/countdown, not just countdown. So you needed $countdown = page('home/countdown').
Your solution works on the home page because $page is the 'home' page in that context, and $page->find looks into its descendants. So what you were doing is similar to page('home')->find('countdown').