Themes

Templates overriding : a small Tutorial

alain01  09-Sep-2006 13:47 12877 Reads   11 Comment(s) 

Note 1:
In both examples, we have just modifed block templates, but for page templates, upload your files to:
/<yourthemefolder>/modules/mymodule
and not in
/<yourthemefolder>/modules/mymodule/blocks.

Note 2:
Have a look at this theme, 7dana-clean.
In this theme you will find:
- The new position blocks (bottom center blocks, bottom left blocks, bottom right blocks, )
- 7 templates for overriding

Note 3:
Copy index.html (from templates_c or any other core folder with index.html) to your new directory.


Images overriding
Finally, image overriding is also possible. 2 possible cases:
- If the module used overriding, you can just copy images the same way as templates overridng,
- Either, Let's modify a template and as:
<img src="<{[color=FF0000]xoImgUrl[/color] modules/mymodule/images/image1.gif}>" alt=""/>


Example:
Change image from the news module (the print.gif image)(article.html template from the news module)

Let's replace the following code in the article.html template
<img src="<{$xoops_url}>/modules/news/images/print.gif" border="0" alt="<{$lang_printerpage}>" />

with
<img src="<{[color=FF0000]xoImgUrl [/color]modules/news/images/icon/print.gif}>" border="0" alt="<{$lang_printerpage}>" />

When the page is displayed, the template will display the image located in /<yourthemefolder>/modules/news/icon/, and if the image doen't exist, the initial image will be displayed (/modules/news/icon).


CSS overriding
For CSS, overriding is used the same way, but the command is different:
<{$xoTheme->addStylesheet('modules/news/style.css')}>


javascript overriding
More information soon.


For developpers
Friends, when you next update your module(s), consider modifying your original templates with these new functionalities (images overriding, css overriding).


Big thanks to Dugris for his précisions on css, images and javascript.


So, now, you can play with that new feature !
« 1 2 3 (4)
Rating 0/5
Rating: 0/5 (0 votes)
Voting is disabled!


Login

Who's Online

137 user(s) are online (5 user(s) are browsing Publisher)


Members: 0


Guests: 137


more...

Donat-O-Meter

Stats
Goal: $100.00
Due Date: Apr 30
Gross Amount: $0.00
Net Balance: $0.00
Left to go: $100.00
Make donations with PayPal!

Latest GitHub Commits

Categories