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() template on its own


Go to End


2 Posts   1572 Views

Avatar
Vladas

Community Member, 17 Posts

6 April 2011 at 8:46pm

So I'm trying to render my page. I have action function within Page_Controller class called ViewSavedJobs. I want so when I call a link in browser http://localhost/Project/ViewSavedJobs, I get a page rendered with ViewSavedJobs.ss that's stored within root of templates folder.

Now what I get is that all defined Requirements within Page.php appear on my rendered page. What is the solution to renderWith() page without all the Page.php Requirements? I don't want to create a separate Page class for that. I need solution so I could use renderWith or something similar.

Thanks.

Avatar
Willr

Forum Moderator, 5523 Posts

7 April 2011 at 11:49am

It uses the requirements you have defined on your controller, irrespective of if your template extends Page since the template engine has no idea about those things. You could call Requirements::clear() before rendering your template which would clear all the requirements defined on that controller.