Jump to:

23453 Posts in 18904 Topics by 2877 members

General Questions

SilverStripe Forums » General Questions » How do I use renderWith() ???

General questions about getting started with SilverStripe that don't fit in any of the categories above.

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

Page: 1 2
Go to End
Author Topic: 7282 Views
  • dompie
    Community Member
    88 Posts

    Re: How do I use renderWith() ??? Link to this post

    Unfortunately it does only work partly for me.

    I have the following controller hierarchy:
    Page -> HotelPage -> DefaultHotelPage -> CommentDefaultHotelPage

    On DefaultHotelPage_Controller I implemented the index() function like this:

       public function index(){
          if($this->getField('ProvideComments') == 0){
             $ssv = new SSViewer(array('HotelPage','DefaultHotelPage_Secondary'));
             return $this->renderWith($ssv);
          return array();

    Unfortunately this seems to prevent CommentDefaultHotelPage to render with CommentDefaultHotelPage.ss. Any ideas how this may be fixed?

    I tried with different return values and even an empty index file. But as soon as I put the index file there SSViewer goes crazy.

  • electronic-womble
    Community Member
    7 Posts

    Re: How do I use renderWith() ??? Link to this post

    Have you tried just

    return $this->renderWith(array('HotelPage','DefaultHotelPage_Secondary'));


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.