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.

We've moved the forum!

Please use forum.silverstripe.org for any new questions (announcement).
The forum archive will stick around, but will be read only.

You can also use our Slack channel or StackOverflow to ask for help.
Check out our community overview for more options to contribute.

Template Questions /

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

Template Inheritance Problem


Go to End


1759 Views

Avatar
bpesner

Community Member, 7 Posts

26 March 2009 at 11:26am

After a new SilverStrip install I modified tutorial/_config.php to comment out the $project variable references. I created a new directory called 'foo' parallel to the tutorial directory, with the same subdirectory structure that tutorial has. I created foo/_config.php as a copy of the file from tutorial, except that I changed the value assigned to $project to 'foo'.

In foo/code I created a file called Page.php as a copy of tutorial/code/Page.php.

In foo/templates I created a file called Page.ss as a copy of tutorial/templates.

I did a db/build and flush. I logged into the CMS. Everything looked good. I then logged out of the CMS.

I then made extensive changes to Page.ss. When I logged into the CMS, it was using my template, so of course the CMS was all messed up.

I tried to deal with this by renaming code/Page.php to foo.php and changing the names of the classes in the file accordingly, and renaming templates/Page.ss to foo.ss. (class foo extends page). I did a db/build and flush and the CMS was back to normal.

I then proceeded happily to add pages to my site, until I tried to add a page based on the USer Defined Form page type. The form fields I defined showed up, but the page isn't using my foo template.

Anyone know if changing Page.ss is supposed to change the appearance (and functionality) if the CMS?

Am I supposed to structure my project differently so that I can define a template that is used with User Defined Forms?

Thanks.