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.

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

RenderWith and $Layout override problem

Go to End

3 Posts   2930 Views


Community Member, 7 Posts

9 December 2009 at 7:50am

Hi there,
I just discovered a weird behaviour or i might do something wrong.

i have in my template a variable $MemberStatus. Then to that i have the function MemberStatus in my page controller.
the function look like this:

function MemberStatus() {
  return $this->renderWith('MemberStatus');

So my template $MemberStatus return the right content but $Layout return aswell content. To fix it i need to add a parameter to the renderWith function as follow:

function MemberStatus() {
  return $this->renderWith('MemberStatus', array('fixingparam'=>'value'));

Any Ideas ?
Br, G.


Community Member, 97 Posts

21 December 2009 at 7:49am

I'm confused. What are you trying to do here? I imagine you're trying to show a member's status in some fancy way using a template. If so you should just be able to have a template templates/Includes/, which uses a placeholder called $MemberStatus or whatever's needed. In your layout template, or a subsequently included template, just use <% include MemberStatus %> to pull in the template.



Community Member, 7 Posts

27 January 2010 at 11:13am

Edited: 27/01/2010 11:14am

Yes defenitly too fancy... Using include will do it perfectly.
The behaviour is not weird at all :P

Best Guillaume.