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.

Template Questions /

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

renderWith and layout


Go to End


3 Posts   8325 Views

Avatar
Jean-Phi

Community Member, 12 Posts

28 January 2009 at 12:19am

Edited: 28/01/2009 12:20am

Hi,

I have a file like this :

templates/Page.ss :

<p>$Layout</p>

and another :

templates/layout/Pages.ss

toto

In a controller I have an action that return :

$this->renderWith('Page');

in the response I have 'toto' instead of :

<p>toto</p>

why?

Avatar
Hamish

Community Member, 712 Posts

28 January 2009 at 8:48am

That's odd. Try adding "?showtemplate=1" to the end of the URL - that will tell you what templates it's hitting.

(btw, does your layout dir have a capital L? Don't know if it matters, but mine always have L instead if l)

Avatar
dio5

Community Member, 501 Posts

28 January 2009 at 9:13am

Edited: 28/01/2009 9:14am

Sure you have flushed? (?flush=1)

On the other hand try

$this->renderWith(array('Page', 'Page'));