Jump to:

3439 Posts in 1028 Topics by 869 members

Template Questions

SilverStripe Forums » Template Questions » renderWith() makes navigation disappear

Moderators: martimiz, Sean, biapar, Willr, Ingo, swaiba, simon_w

Page: 1 2
Go to End
Author Topic: 8025 Views
  • schellmax
    Avatar
    Community Member
    126 Posts

    Re: renderWith() makes navigation disappear Link to this post

    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!

  • javelin
    Avatar
    Community Member
    12 Posts

    Re: renderWith() makes navigation disappear Link to this post

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

    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)

    8025 Views
Page: 1 2
Go to Top

Want to know more about the company that brought you SilverStripe? Then check out SilverStripe.com

Comments on this website? Please give feedback.