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.

All other Modules /

Discuss all other Modules here.

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

Proper way to customize module templates and css?


Go to End


3 Posts   2292 Views

Avatar
theoldlr

Community Member, 103 Posts

5 June 2010 at 8:54am

Edited: 05/06/2010 8:55am

Hi,

I once customized the PageComments template by copying the .ss file to the themes/mysite/templates folder and made my changes there--Worked great, and upgrading should be no problem now. However, the next time I tried to do this was with a template from a module (the blog module if I remember right). This did not work. What is the proper way to do this so upgrading a module is less painful? What about for custom .css files?

Thanks!

Avatar
UncleCheese

Forum Moderator, 4102 Posts

5 June 2010 at 9:19am

Any template that is in your theme dir will override one in a module directory, so in your theme dir, just create BlogHolder.ss, for instance.

Same with CSS.. provided the module loads the CSS with themedCSS(), you can just put your own stylesheet in your theme dir..

Requirements::themedCSS('Blog'); will look for Blog.css first in your theme dir, then fall back on the module.

Avatar
kidcardboard

Community Member, 5 Posts

29 June 2010 at 10:16am

Maybe it's just me but I'm having issues getting this to work with the TagCloud widget... I've tried putting my own tagcloud stylesheet in my theme directory as well as my theme_blog directory aswell as in a css directory in the both of those, and everytime it would always include the default one from the module. What am I missing. Does it maybe have something to do with the widget adding the stylesheet via

Requirements::css("blog/css/tagcloud.css");

instead of

Requirements:: themedCSS("blog/css/tagcloud.css");

??