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

SOLVED - create a template page that does not extend any other

Go to End

3 Posts   639 Views


Community Member, 9 Posts

10 January 2012 at 1:25am

Hey, i am trying to make the main hope page tutorial not extend page as i am creating its own CSS and i have hit a snag

first, how do you make a the MainHomePage not be an extention of page.
seccond, how do you add a unique CSS to one page?
thanks for any help


Community Member, 189 Posts

10 January 2012 at 2:12am

Edited: 10/01/2012 2:16am

instead of extending Page extend SiteTree

class MainHomePage extends SiteTree {


class MainHomePage_Controller extends ContentController {


that should work. If the only reason you want to do this is to have custom CSS on your homepage, you can still extend Page and have different CSS for MainHomePage.

instead of putting your template in /templates/layout, put in your /templates folder and then use <% require themedCSS() %> to include the css files you want.

Another way to include CSS is through the use of Requirements in your init() function

class MainHomePage_Controller extends Page_Controller {

       public function init() {

		Requirements::CSS('themes/'. SSViewer::current_theme() .'/css/file.css');



Community Member, 9 Posts

10 January 2012 at 2:52am

thanks worked!