Jump to:

22984 Posts in 11765 Topics by 2827 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: 6321 Views
  • dompie
    Avatar
    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
    Avatar
    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'));

    ?

    6321 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.