Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

Template Questions /

renderWith() makes navigation disappear


Go to End
Reply


10 Posts   8370 Views

Avatar
schellmax

Community Member, 126 Posts

20 January 2009 at 2:56am

thank you very much ajshort!
your suggestion using '$controller->getViewer('index')->process($controller)' works like a charm.
maybe once you have time to leave some comment on what this line exactly does, but for now i'm very happy with it.

for a short explanation on why i don't want to link directly to my projectpages:
i'm using a kind of filter to categorize my projectpages, having each projectpage linked to some filterpages.
each filterpage renders a thumbnail of the projectpages linked to it, which leads to the projectpage.
problem is, the projectpages itself are located elsewhere in the sitetree, so if would link the thumbnail there directly, the navigation wouldn't reflect the path of the filterpage i came frome any more.
that's why i decided to render the projectpage using a method of my filterpage (using an url like 'filterpage/project/id') which allows me to stay on my filterpage and have it highlighted properly in the navigation.

i hope that's somewhat comprehensible!

Avatar
javelin

Community Member, 12 Posts

27 April 2010 at 10:12pm

Thanks again. This really confused me for a long long time. The dokumentation for renderWith
at for example: [url]http://api.silverstripe.org/2.3/sapphire/view/ViewableData.html#methodrenderWith[/url]

says:
An array of template names. The first template that exists will be used

This did seem to mean that only the first template would be used and that the rest of the array was only for "backup" but in fact it uses those values too. Including "Page" for example in the array ensures that the rest of my page shows up, with navigation, css etc etc.
Otherwise, without "Page" in the array the first template was rendered on its own without any other templates higher in the hierarchy.

It was also important to pass it as an array and not as a list of arguments. (Although renderWith didn't complain)

Go to Top