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're retiring the forums!

The SilverStripe forums have passed their heyday. They'll stick around, but will be read only. We'd encourage you to get involved in the community via the following channels instead:

Template Questions /

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

renderWith() and $Layout

Go to End


Vegas Rob

Community Member, 5 Posts

22 January 2011 at 7:51am

I was trying to replicate the functionality in this old example: (couldn't find a similar example in the new docs)

Page.php contains the following index method which will render Templates/ as expected.

public function index()
if($this->isAjax || $_GET['isAjax'] == '1')
return $this->renderWith('Ajax');
return array();

The issue I'm having is that it seems that when using renderWith() the $Layout "special include" no longer behaves has it would when rendering templates normally. I even stripped it down so that $Layout was all that was left in As a result I can't seem to optionally wrap my Layout content for XHR delivery.

Any help in getting past this roadblock will be much appreciated. Thanks for your time and thoughts.