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

Strange Template Problem


Go to End


3 Posts   1647 Views

Avatar
alana

Community Member, 7 Posts

25 February 2014 at 11:00pm

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

Avatar
Willr

Forum Moderator, 5523 Posts

1 March 2014 at 11:36am

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

Avatar
alana

Community Member, 7 Posts

2 March 2014 at 7:03am

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!