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.

Template Questions

Template overriding question


Reply

4 Posts   991 Views

Avatar
Borgopio

12 January 2012 at 3:37am Community Member, 14 Posts

Hi all,

my company is developing a module that will be shipped with a default theme. For our clients we want to provide also a little set of other themes, but also we want to allow any client to customize its installation (without modify the theme).

So I'm trying to use the override capabilities of the template system as stated in the doc: http://doc.silverstripe.org/sapphire/en/topics/theme-development#overriding
but I've noticed that mysite/ (or any folder set in the $project) doesn't override anything existing in the theme. I've found this ticket http://open.silverstripe.org/ticket/3300 and tried the patch on the SSViewer.php. Anyhow now I'm able only to override Layout templates but not /Includes or /css.

In the core dev group (http://groups.google.com/group/silverstripe-dev/browse_thread/thread/d44d99dc7f264a0b/5367cb24766de047?lnk=gst&q=template+override#5367cb24766de047) seems that with SS3 the template order inclusion will be rewritten, but for now there's any suggestion to let mysite/ override theme/ files (.css or .ss)?

It seems to me that for every SS installation (with 2.x) I'll must edit in some way the theme I use. I'm right or maybe I've done something wrong?

Avatar
Borgopio

12 January 2012 at 5:56am Community Member, 14 Posts

I try to better explain my situation.

This is the priority of the files as far as I can see with some test:
1 - themes/xxxtheme/css/style.css
2 - module/css/style.css
3 - mysite/css/style.css

Has anyone ever override /themes files (css or templates) with other files in /mysite folder?

Thanks for the help ;)

Avatar
Willr

14 January 2012 at 4:29pm Forum Moderator, 5511 Posts

At the moment themes override mysite. Like you found, there is discussion to change this but for now, you need to edit the theme or store you overrided templates in a subtheme like themes/xxxtheme_custom/.. which should? override themes/xxxtheme.

Avatar
Borgopio

18 January 2012 at 12:06am (Last edited: 18 January 2012 12:32am), Community Member, 14 Posts

Thank's for the reply. I posted a comment also in the doc (http://doc.silverstripe.org/sapphire/en/topics/theme-development#overriding) hope that helps to avoid misunderstanding.

Anyhow this seems to me quite a big issue for Silverstripe and Theme/Module development, hope that release 3 will fix it.

UPDATE (little later) - yes, the subtheme can override a module, but you must call the subtheme like the theme plus _ (underscore) and the module's name (eg. theme/theme_module/). So is not really useful for my issue ;)