23370 Posts in 18160 Topics by 2864 members
Page: 1 2
|Go to End||Next >|
7 September 2010 at 7:45am
I think this ought to be in here, as it seems a bit basic for the Templates forum, but sorry if I'm wrong!
I've just started working with this excellent CMS, and am following the tutorials to learn how to get the most out of it. My problem is with creating a new template. I've created a HomePage.php file in /mysite/code, added a Page.ss and HomePage.ss to /themes/tutorial/templates/Layout, and added the $Layout tag to the Page.ss file in /themes/tutorial/templates. I have also flushed the database using ?flush=1, as the tutorial states. However, when I go back into the CMS, the new HomePage template doesn't show up in the list - only the Page template and the other ones that come by default.
I've searched around, and this problem seems to have come up before, but only on 2.3 - I'm running 2.4. Does anybody have any idea what's wrong, or is it something stupid that I've missed, somewhere?
7 September 2010 at 8:00am
Not sure what you mean with 'Does not show op in the CMS', but in SiteConfig there is only a list with installed themes, not seperate template files.
In the create list in the CMS Left pagetype select dropdown, should be all PageTypes you created.
SS will select the templates based on the PageType classname and the corresponding template filename.
Also you might try to use ?flush=all .
7 September 2010 at 6:34pm
OK, I'll try and explain it a bit better.
When I created a template as per the tutorial, after using ?flush=1, the list of templates does not show the new HomePage template - neither under the Create button on the left, or in the Behaviour tab of any page. I've followed all of the Tutorial instructions, and when it talks about changing the PageType of an existing page, I can't, because the new Template isn't in the list to change it to.
I've just tried ?flush=all, and that doesn't work either.
7 September 2010 at 8:21pm
You're confusing things here. I think you mean a new "Page-Type" and not a new template. The types you can select in the CMS for creation are "Page-Types".
To make new types available you have to run dev/build
8 September 2010 at 3:20am
OK, I see now. Yes, it is a Page Type that I'm meaning. However, I don't see what you mean by /dev/build - the only dev folder I can find is /sapphire/dev, and it doesn't have any file called build in it. Even so, the tutorial maintains that you use ?flush=1, and that makes it available. Have I missed a /dev folder, or is there some other problem?
8 September 2010 at 4:01am Last edited: 8 September 2010 4:12am
Running dev/build, recreates the Manifest file which stores Class information from Silverstripe and will rebuild the database.
In order to let Silverstripe know you added a new PageType, you need to rebuild the Manifest file and the database.
You do this by adding dev/build to your site like:
You will see a blue screen which shows information about which database tables and fields are changed.
See this page for more info:
The dev part is redirected to (sapphire/dev/)DevelopmentAdmin(.php) with Director::addRules() in sapphire/_config.php;
From there the specific task is run.
Yoy can see the available tasks by only appending only /dev to your siteurl.
8 September 2010 at 5:27am
When I enter www.example.org/dev/build?flush=all, I get a 404 Page not Found error, as if the CMS isn't redirecting the request. I also tried directly accessing the file by www.example.org/sapphire/dev/DevelopmentAdmin.php?flush=all, and got a 404 again.
8 September 2010 at 5:57am
Page: 1 2
|Go to Top||Next >|