I really need to create pagetype, that will redirect me to first of it's children... I.E.
- Page 1 {/page1/}
- Child 1 {/page1/child1/}
- Child 2 {/page1/child2/}
and when you click on 'Page 1' in menu, you'll go straight to '/page1/child1/'.
For pages that you want to automatically direct to the first child, I would make them use a template that has this in it's code:
<?php if($page->numChildren) $session->redirect($page->child()->url);
And then, when you add another child, the internal pointer will redirect there.
If you add a new child page, and they aren't sorted by date added (descending) then the newly added page isn't likely to be the first child. If no default sort is selected, then it'll add it as the last child. So if you wanted to redirect to last page (rather than the first) then you'd want to do this:
<?php if($page->numChildren) $session->redirect($page->child("sort=-sort")->url);
By the way "sort" is just a name representing the order that pages have been dragged/dropped to. That's the default value if a page doesn't have another field selected as it's default sort field. The minus sign "-" in front of it represents descending sort. Without the minus sign, it would be ascending. Since you want to select the last page, that's why it's "-sort" rather than "sort".
Or if you wanted to make it select the most recent page added by date:
<?php if($page->numChildren) $session->redirect($page->child("sort=-created")->url);
The above is also descending since most recent added would be the highest date.













