4579 Posts in 1388 Topics by 1378 members
|
Page:
1
|
Go to End | |
| Author | Topic: | 597 Views |
-
Setting a new page style

31 August 2011 at 8:00am
Hi,
Where do I set a new page style in order to be able to see it at the behavior page stye combo box? I've a custom HomePage.ss but I need to apply that page style to my home page.
Thanks
-
Re: Setting a new page style

31 August 2011 at 8:20am
Besides the HomePage.ss template, you need a HomePage.php PageType file. Even an empty class is enough:
<?php
class HomePage extends Page {
}
class HomePage_Controller extends Page_Controller {
}Once you do a /dev/build/?flush=1, the new pagetype should be available in the create dropdown (top left) as well as the behavior page stye combo box.
-
Re: Setting a new page style

31 August 2011 at 11:33am
right, I do have a HomePage.php file with that empty class at /www/mysite/code and I did also a database rebuild as suggested, but still no "homepage" at the Page Type options
any extra ideas? -
Re: Setting a new page style

31 August 2011 at 9:28pm
Adding the empty HomePage class file and doing a /dev/build/?flush=1, then reloading the admin section should be enough. I have had problems with it every once in a while, but they were always my fault:
- forgot to add <?php at the top of the file (stupid haste)
- spelling errors: the classname not equal to the filename (case-sensitive!)One other thing may be viewing permissions - but never if you're logged in as admin...
-
Re: Setting a new page style

31 August 2011 at 9:52pm
I don't think I've forgotten anything...and this file is already working on another website.
<?php
/**
* Defines the HomePage page type
*/class HomePage extends Page {
static $db = array(
);
static $has_one = array(
);
}class HomePage_Controller extends Page_Controller {
}
?> -
Re: Setting a new page style

31 August 2011 at 11:38pm
Hi,
maybe removing ?> should do the trick?
When there are empty lines under ?> it might go wrong. -
Re: Setting a new page style

1 September 2011 at 12:29am Last edited: 1 September 2011 12:30am
To find out if the HomePage is at all found properly, You could check the 'manifest' file in the silverstripe-cache directory: it should have something like:
'homepage' => '/some/fysical/path/mysite/code/HomePage.php'
If not, in some weird cases just emptying the silverstripe-cache directory helps...
-
Re: Setting a new page style

1 September 2011 at 2:25am
Thanks guys, I was able to finally add the "homepage" pagetype in the create dropdown (top left) as well as the behavior page stye combo box.
I had to delete all blank spaces at HomePage.php , rebuild, delete the original Home page at the content management, and create a new one otherwise I could not apply the page type to the already created content. So it looks like it was a cache issue.
| 597 Views | ||
|
Page:
1
|
Go to Top |


