Jump to:

3435 Posts in 1026 Topics by 866 members

Template Questions

SilverStripe Forums » Template Questions » Template overriding question

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

Page: 1
Go to End
Author Topic: 924 Views
  • Borgopio
    Avatar
    Community Member
    14 Posts

    Template overriding question Link to this post

    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?

  • Borgopio
    Avatar
    Community Member
    14 Posts

    Re: Template overriding question Link to this post

    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 ;)

  • Willr
    Avatar
    Forum Moderator
    5490 Posts

    Re: Template overriding question Link to this post

    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.

  • Borgopio
    Avatar
    Community Member
    14 Posts

    Re: Template overriding question Link to this post

    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 ;)

    924 Views
Page: 1
Go to Top

Want to know more about the company that brought you SilverStripe? Then check out SilverStripe.com

Comments on this website? Please give feedback.