Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

General Questions

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

Problem creating new template as tutorial suggests


Reply

5 Posts   459 Views

Avatar
onion

12 January 2012 at 5:00am Community Member, 10 Posts

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
Avatar
bit99

12 January 2012 at 6:42am Community Member, 24 Posts

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

Avatar
onion

12 January 2012 at 6:57am Community Member, 10 Posts

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.

Avatar
bit99

12 January 2012 at 7:20am Community Member, 24 Posts

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.

Avatar
onion

12 January 2012 at 10:11pm Community Member, 10 Posts

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!