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.

We've moved the forum!

Please use forum.silverstripe.org for any new questions (announcement).
The forum archive will stick around, but will be read only.

You can also use our Slack channel or StackOverflow to ask for help.
Check out our community overview for more options to contribute.

General Questions /

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

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

How do I use renderWith() ???


Go to End


10 Posts   18084 Views

Avatar
dompie

Community Member, 88 Posts

26 May 2011 at 11:45pm

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.

Avatar
electronic-womble

Community Member, 7 Posts

27 May 2011 at 1:34am

Have you tried just

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

Go to Top