Use a theme override

Boko

Joined: 2010-11-15
Posts: 11
Posted: Mon, 2010-11-15 15:23

I've been searching on the forum but couldn't find an answer to my question. So here it is:

In the wiki it says "Use a theme override: starting in Gallery 2.3, themes are able to override module tpl files. ". How do I make this work?

I'm using Gallery 2.3.1 but I can't figure out how to "Use a theme override". I can make it work with a 'local' folder but I'd rather have everything packed into my theme folder.

Thanks in advance!

 
suprsidr
suprsidr's picture

Joined: 2005-04-17
Posts: 8339
Posted: Mon, 2010-11-15 18:01
 
Boko

Joined: 2010-11-15
Posts: 11
Posted: Tue, 2010-11-16 12:28

The Systemlinks.tpl file in 'gallery2\modules\core\templates\blocks\'.
I have made some adjustments in the separator.

Edit: just to be clear, I didn't set the separator, I removed the last trailing seperator.

I just need to know how to properly theme override and this should be documented in the wiki too.

 
suprsidr
suprsidr's picture

Joined: 2005-04-17
Posts: 8339
Posted: Tue, 2010-11-16 14:48

For something as minor as removing the last separator, I'd do it w/ css.

http://codex.gallery2.org/Gallery2:Themes

-s
FlashYourWeb and Your Gallery with The E2 XML Media Player for Gallery2

 
Boko

Joined: 2010-11-15
Posts: 11
Posted: Tue, 2010-11-16 16:03

No, I want to do a theme override. I already have it working with the local folders and that's just as fine as a css solution for me.

http://codex.gallery2.org/Gallery2:Editing_Templates

See how clear it is documented on how to do a theme override? You and I need that stuff documented.

 
suprsidr
suprsidr's picture

Joined: 2005-04-17
Posts: 8339
Posted: Tue, 2010-11-16 16:38
Quote:
You and I need that stuff documented

Speak for yourself.
The codex is for the users by the users, so if you feel something is missing - jump in and document it.

But as to what you are referring to:
I'm going to assume they are referring to http://gallery.menalto.com/apidoc/GalleryCore/Classes/GalleryTheme.html#methodshowModulePage
and directly in your templates, you can do things like:

{if $itemLink.moduleId == "slideshow"}
  {g->theme include="SlideshowButtons.tpl"}
{/if}

or

{if $theme.pageType == 'module'}
  {g->theme include="module.tpl"}
{/if}

to see all of the current page's smarty variables, set yourself in buffered debug mode.
FAQ: How to set/use Gallery in debug mode?

-s
FlashYourWeb and Your Gallery with The E2 XML Media Player for Gallery2

 
suprsidr
suprsidr's picture

Joined: 2005-04-17
Posts: 8339
Posted: Tue, 2010-11-16 16:49
 
floridave
floridave's picture

Joined: 2003-12-22
Posts: 27300
Posted: Wed, 2010-11-17 04:15

In 2.2 or 2.3 we added ability for themes to override module templates. Example:
modules/foo/templates/bar.tpl
First look in modules/foo/module.inc and find the setTemplateVersion line near the top. If there is no such line, the version is 0 (zero). Copy bar.tpl to:
themes/yourtheme/templates/foo_templateversion/bar.tpl

..and edit the copy to fit the theme. If the theme is used on an older version of Gallery the overrides will not be used.

Another real world example:
I am using the matrix theme.
I want to change the behavior look of the Language selector dropdown.....
I copy:
gallery2/modules/core/templates/blocks/LanguageSelector.tpl
to:
gallery2/themes/matrix/templates/core_1/blocks/LanguageSelector.tpl
Edit that file, clear template cache and you are done.

I got core_1 from core and added _1
because I looked in /gallery2/modules/core/module.inc and found the template version is 1.

I hope you can make sense of this. It is more complex than it had to be but we had to accommodate different template versions. It never really progressed but the code for overriding is there.

Please update the documentation as I don't have time or energy for G2 much anymore. And you can see my docs skills are low.

Dave

_____________________________________________
Blog & G2 || floridave - Gallery Team

 
Boko

Joined: 2010-11-15
Posts: 11
Posted: Wed, 2010-11-17 08:11

Very clear, thank you all for the effort.
I will update the documentation when I've gotten it to work!

 
Boko

Joined: 2010-11-15
Posts: 11
Posted: Wed, 2010-11-17 08:38

Funny, that documentation was already there only it was hidden in a <toggle> tag that wouldn't show up. You might want to take a look at that. I removed the toggle tag so it always shows. Thanks for the help guys.

 
Boko

Joined: 2010-11-15
Posts: 11
Posted: Fri, 2010-11-19 15:13
suprsidr wrote:
Quote:
You and I need that stuff documented

Speak for yourself.
The codex is for the users by the users, so if you feel something is missing - jump in and document it.

By the way, this comment wasn't smart and I'll tell you why and I'll also tell you something you can learn from for as you can see; I'm also trying to help.

You and I DO need that stuff documented so you won't have to help anyone else with the same problem. More good and useful documentation is always better, I can't see why you disagree with me on that. The second part is that you're telling me to document something I haven't figured out yet and for which I came to here to get help with.

The lesson: don't help people you don't want to help, it's not good for you. If you do want to help but just thought that I was being an ignorant retard: be less of a bitch about it.

And again, thanks for all the help.

 
suprsidr
suprsidr's picture

Joined: 2005-04-17
Posts: 8339
Posted: Fri, 2010-11-19 15:19
 
Boko

Joined: 2010-11-15
Posts: 11
Posted: Fri, 2010-11-19 16:01

Yes