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.

General Questions /

General questions about getting started with SilverStripe that don't fit in any of the categories above.

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

[solved] Question about custom page type setup


Go to End


10 Posts   3981 Views

Avatar
Faloude

Community Member, 55 Posts

5 March 2015 at 2:17am

Awesome! It works!

Thanks for clarifying that. I used Webdoc's code but put it in mysite/code/homepage.php

The filename of mysite/code/homepage.php doesn't have to match the layout filename themes/mytheme/templates/layout/homepage.ss right?

Avatar
Nightjar

Community Member, 28 Posts

5 March 2015 at 2:38am

No, the filename can be anything. The file itself can be almost anywhere. The project dir can be renamed (from mysite) through the _config.php $project variable.
Templates can be stored in either a theme (themes/<themename>/templates/) or the module (your project is technically a module too! - <mysite>/temlpates)

Just the class name and the template filename must match.
eg. if for instance you had themes/yourtheme/templates/HomePage.ss, then this would be used as the 'main' template, the 'Layout' would then be HomePage or Page, but only if there is a $Layout var present in the 'main'.

In this way templates sort of mirror the class heirarchy in the manner they're searched for/used.

It can be all a bit confusing when you're just getting used to it, but it makes a lot of sense once you do :)

Go to Top