21288 Posts in 5733 Topics by 2602 members
General Questions
SilverStripe Forums » General Questions » [SOLVED] Action function Layout is rendering without Page template
General questions about getting started with SilverStripe that don't fit in any of the categories above.
Moderators: martimiz, Howard, Sean, Ryan M., biapar, Willr, Ingo, swaiba, simon_w
|
Page:
1
|
Go to End | |
| Author | Topic: | 319 Views |
-
[SOLVED] Action function Layout is rendering without Page template

7 March 2012 at 5:55am
I have done a work around for the following problem in the past but I think I need to find a proper solution now.
My problem is this
1. I have a page type of, e.g. ParentPage
2. I have other page types e.g. ChildPage1 & ChildPage2, which extend ParentPageI have put an action function in the ParentPage that I want all child page types to access, e.g. function addnote() as shown here: -
function addnote()
{
$data = array(...);
return $this->customise($data)->renderWith("ParentPage_addnote", "ParentPage");
}I have a main template called ParentPage.ss and in the Layout folder I have a layout template called ParentPage_addnote.ss
Now I have setup a few pages of the ChildPage1 type and go to it by domain.com/childpage/addnote the function works and the ParentPage_addnote.ss layout is rendered, but it is rendered without the page template shell ParentPage.ss
Where am I going wrong?
-
Re: [SOLVED] Action function Layout is rendering without Page template

7 March 2012 at 11:50pm
OK, found the answer: -
return $this->customise($data)->renderWith("ParentPage_addnote", "ParentPage");
Needs to be: -
return $this->customise($data)->renderWith(array("ParentPage_addnote", "ParentPage"));
| 319 Views | ||
|
Page:
1
|
Go to Top |

