Jump to:

23377 Posts in 18296 Topics by 2868 members

General Questions

SilverStripe Forums » General Questions » Problem creating new template as tutorial suggests

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
Go to End
Author Topic: 431 Views
  • onion
    Avatar
    Community Member
    10 Posts

    Problem creating new template as tutorial suggests Link to this post

    I've been following the excellent tutorial here: http://doc.silverstripe.org/sapphire/en/tutorials/1-building-a-basic-site which is very clear, but I have a problem.

    I've created a new file inside mysite/code and and pasted in the code from the tutorial above. I then flushed my database using the url http://localhost/silverstripe/?flush=1

    But when I go back into the admin system (I refreshed the page first), choose a page and go to "behaviours", the page type dropdown doesn't show my new page type.

    Is there an additional step that I'm missing?

    Thanks

    Attached Files
  • bit99
    Avatar
    Community Member
    24 Posts

    Re: Problem creating new template as tutorial suggests Link to this post

    Hi Onion,
    first thought,
    - did you add the new pagetype to the theme?

    ex. if you have /mysite/code/newpage.php
    you also need /themes//themename/templates/Layout/newpage.ss

    and then refresh the page and it should show up

  • onion
    Avatar
    Community Member
    10 Posts

    Re: Problem creating new template as tutorial suggests Link to this post

    Hi thanks for the reply, I've tried this to no avail. I'm not actually sure if it does need a file in the template directory, the tutorial shows that you can select the new page type before a template is created. Also at the bottom of the tutorial it says "We can then delete themes/tutorial/templates/HomePage.ss, as it is no longer needed."

    I thought this could be a problem with my browser's cache, but I've tried it in a different browser and it still doesn't show.

  • bit99
    Avatar
    Community Member
    24 Posts

    Re: Problem creating new template as tutorial suggests Link to this post

    Hi,
    I just looked through the tutorial, havent actually read it for a long time,

    you can definitely get rid of
    themes/tutorial/templates/HomePage.ss

    but you need
    themes/tutorial/templates/Page.ss
    themes/tutorial/templates/Layout/Page.ss
    themes/tutorial/templates/Layout/HomePage.ss

    also, I noticed you wrote http://localhost/silverstripe/?flush=1
    when I flush - I always have http://localhost/dev/build?flush=1
    or if in a subdirectory http://localhost/silverstripe/dev/build?flush=1
    or I usually do flush=all
    see if you get a database build success.

  • onion
    Avatar
    Community Member
    10 Posts

    Re: Problem creating new template as tutorial suggests Link to this post

    Oh! I was going to the wrong address, I thought /dev was the folder of the application, where I'd unoriginally called mine "silverstripe". If I go to that url it shows me the db has been rebuilt. Much better!

    Thanks very much!

    431 Views
Page: 1
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.