Jump to:

3444 Posts in 1030 Topics by 871 members

Template Questions

SilverStripe Forums » Template Questions » Template Inheritance Problem

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

Page: 1
Go to End
Author Topic: 867 Views
  • bpesner
    Avatar
    Community Member
    7 Posts

    Template Inheritance Problem Link to this post

    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.

    867 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.