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.

Upgrading SilverStripe /

Ask questions about upgrading SilverStripe to the latest version.

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

location for module template?


Go to End


9 Posts   4343 Views

Avatar
bunheng

Community Member, 78 Posts

13 July 2014 at 4:34am

Edited: 14/07/2014 7:07pm

Hi There,

I created "news" module for my website, there is a template placed in folder news/templates/Layout/NewsPage.ss, every time I view the Latest News page it's always locate the correspondent template in the them folder (theme/themename/templates/Layout) could anyone assist on this?

Thanks

Avatar
Willr

Forum Moderator, 5523 Posts

13 July 2014 at 8:45pm

Folder should be called templates (not template)

Avatar
bunheng

Community Member, 78 Posts

14 July 2014 at 7:12pm

Hi Willr,

Thank you very much for your reply, sorry for the miss typing, I placed the template in correct folder inside module/templates/Layout but it doesn't appear, but it works if I put in theme folder theme/templates/Layout. I can't move forward now.

Thanks
Bunheng

Avatar
Willr

Forum Moderator, 5523 Posts

14 July 2014 at 7:34pm

Make sure you module has been loaded (it should contain a _config.php or a _config directory) and do a ?flush=1.

Avatar
bunheng

Community Member, 78 Posts

14 July 2014 at 8:39pm

Hi Willr,

Thanks for your reply, I did everything but still locate the layout from Theme folder not module folder. I upload the mudule here http://www.tslrdp.org/news.rar.

Thanks
Bunheng

Avatar
Willr

Forum Moderator, 5523 Posts

14 July 2014 at 9:16pm

Downloaded that, rebuilt the manifest, created a NewsPage in the CMS and it picked up the template. Note your template has an issue on 3.1

You shouldn't use <% control %> anymore, use <% loop %>.. The other thing is your loop is named LatestNews where as that isn't defined anywhere to use it. Think you want to call NewsItems

Avatar
bunheng

Community Member, 78 Posts

25 July 2014 at 11:24pm

Hi Willr,

Thanks for your time valued time and response. I tried several time, but it's still render the template from theme folder not from module template folder.

Thanks
Bunheng

Avatar
Willr

Forum Moderator, 5523 Posts

25 July 2014 at 11:28pm

Oh hang on. I'm pretty sure theme files superseed (replace) templates defined in modules. When I tried you version I put the files in I didn't have your theme files overriding it. Any reason why you want to use the module template over the theme template?

Go to Top