Jump to:

3439 Posts in 1028 Topics by 869 members

Template Questions

SilverStripe Forums » Template Questions » Strange Template Problem

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

Page: 1
Go to End
Author Topic: 433 Views
  • alana
    Avatar
    Community Member
    7 Posts

    Strange Template Problem Link to this post

    I'm trying to create a custom template as follows:

    Within mysite/code I have set up a membership.php page as follows:

    class Membership extends Page {

    }

    class Membership_Controller extends Page_Controller {

    }

    Then in my layout folder I have a Membership.ss template file. Then I dev/build and flush but when I open the page the template is not picked up, it defaults to Page.ss

    Now here is the weird part, if I copy the site structure to my local sever the template is found and works as exepcted, This led me to suspect the issue was file permissions on my dev server but I have double checked and full permissions are set on the files which I have created.

    Any ideas?

    Thanks.

    Alan

  • Willr
    Avatar
    Forum Moderator
    5497 Posts

    Re: Strange Template Problem Link to this post

    Are you sure your page in the CMS is of type Membership and hasn't reverted back to Page for any reason?

  • alana
    Avatar
    Community Member
    7 Posts

    Re: Strange Template Problem Link to this post

    I discovered the problem, it was because I was missing this in my php page:

    function getInfo() {
    return $this->renderWith('Media');
    }

    Hopefully this will other save time!

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