Jump to:

23483 Posts in 18976 Topics by 2878 members

General Questions

SilverStripe Forums » General Questions » Templates not Showing in the CMS

General questions about getting started with SilverStripe that don't fit in any of the categories above.

Moderators: martimiz, Sean, biapar, Willr, Ingo, swaiba, simon_w

Page: 1 2
Go to End
Author Topic: 2268 Views
  • SmartRoss
    Avatar
    Community Member
    13 Posts

    Templates not Showing in the CMS Link to this post

    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?

  • Martijn
    Avatar
    Community Member
    271 Posts

    Re: Templates not Showing in the CMS Link to this post

    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 .

  • SmartRoss
    Avatar
    Community Member
    13 Posts

    Re: Templates not Showing in the CMS Link to this post

    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.

  • banal
    Avatar
    Community Member
    901 Posts

    Re: Templates not Showing in the CMS Link to this post

    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

  • SmartRoss
    Avatar
    Community Member
    13 Posts

    Re: Templates not Showing in the CMS Link to this post

    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?

  • Martijn
    Avatar
    Community Member
    271 Posts

    Re: Templates not Showing in the CMS Link to this post

    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:

    www.example.org/dev/build?flush=all

    You will see a blue screen which shows information about which database tables and fields are changed.

    See this page for more info:

    http://doc.silverstripe.org/urlvariabletools?s[]=dev#building_and_publishing_urls

    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.

  • SmartRoss
    Avatar
    Community Member
    13 Posts

    Re: Templates not Showing in the CMS Link to this post

    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.

  • Martijn
    Avatar
    Community Member
    271 Posts

    Re: Templates not Showing in the CMS Link to this post

    Ehm, you did not really tried example.org?

    I mean www.yoursite.org/dev/build

    And if you installed in a subfolder something like:

    www.yoursite.com/subfolder/dev/build

    Make sure you have set Director::set_environment_type("dev"); in you config.php file.

    2268 Views
Page: 1 2
Go to Top

Want to know more about the company that brought you SilverStripe? Then check out SilverStripe.com

Comments on this website? Please give feedback.