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

Template not found - I'm lost in the SS folder structure


Reply


3 Posts   501 Views

Avatar
tommymato

Community Member, 6 Posts

23 July 2012 at 10:21pm

(I'm trying to follow the book SilverStripe - The Complete Guide to CMS Development.)

I've added a new page type defined in the php file: public_html\mysite\code\JobCategoryHolder.php
So far, so good. The new page type shows up in the CMS backend. I can create a page based on this type.

However, I now need to change the template that matches that page type. The book tells me to create a template called JobCategoryHolder.ss in public_html\themes\mysite\templates\.
That seems to make logical sense. I did that. I then made some small changes to the template (adding a few xxx after the title, etc) just to see if the new template gets picked up. It doesn't.

I tried the dev/build/?flush=1 but nothing seems to work. I also tried copying the template to the Layout subfolder. That didn't work either. I'm lost now. I can't get my head around what should be in which folder. Any ideas?

Has the folder structure changed between when the book was written? The book was based on 2.3.3 and I'm using 2.4.7.

Many thanks to the clever person who answers this :-)

Tom

(p.s. I'm very impressed with SS so far - and the book - but occasionally find things in the book that don't match what I'm seeing.)

Avatar
Willr

Forum Moderator, 5513 Posts

23 July 2012 at 10:54pm

Make sure your page is selected as a 'JobCategoryHolder' in the CMS. Then visit your page with ?flush=1 appended - yoursite.com/jobs?flush=1 to flush the built in templates. You can use ?showtemplate=1 to see what template SilverStripe is using if you need.

Has the folder structure changed between when the book was written? The book was based on 2.3.3 and I'm using 2.4.7.

Slightly, but yes 2.3 is now quite old. There was an updated book for 2.4 but the general ideas in 2.3 still hold true in 2.4 (unlike 3.0).

Avatar
tommymato

Community Member, 6 Posts

24 July 2012 at 9:29pm

Many thanks for that. It did the trick.

Tom