3212 Posts in 847 Topics by 809 members
|
Page:
1
|
Go to End | |
| Author | Topic: | 212 Views |
-
SOLVED - create a template page that does not extend any other

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
=] -
Re: SOLVED - create a template page that does not extend any other

10 January 2012 at 2:12am Last edited: 10 January 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 MainHomePage.ss template in /templates/layout, put MainHomePage.ss 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() {
parent::init();Requirements::CSS('themes/'. SSViewer::current_theme() .'/css/file.css');
}}
-
Re: SOLVED - create a template page that does not extend any other

10 January 2012 at 2:52am
thanks worked!
| 212 Views | ||
|
Page:
1
|
Go to Top |


