Source image from theme in index.tpl

Skinning and designing Serendipity (CSS, HTML, Smarty)
Post Reply
DarKRaveR
Regular
Posts: 20
Joined: Wed Mar 29, 2006 7:35 am
Location: FFM, Germany

Source image from theme in index.tpl

Post by DarKRaveR »

Hi all,

Within the index.tpl in a theme, I want to make use of an image, which comes along the theme. The question now is, which variable gives me the right path to the template directory?

{$serendipityBaseURL} gives the baseurl, is there a similiar variable for the template directory?

Any documentation on all functions/variables that can be used within the smarty templates?
DarKRaveR
Regular
Posts: 20
Joined: Wed Mar 29, 2006 7:35 am
Location: FFM, Germany

Post by DarKRaveR »

Is {serendipity_getFile file=""} really the only way, of doing this? no direkt variable giving the baseurl to the template directory ?
garvinhicking
Core Developer
Posts: 30022
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Post by garvinhicking »

Yes, this function is the only way. This is because the templates can be nested inside the directory, depending on how people put it.

A theme can not only be in /serendipity/themes/mytheme, but other people could have it in /serendipity/themes/more_themes/mytheme/.

This function also ensures that if a specific file is not found in the current template, it falls back to the default template. Which is a very good thing to have, and many users appreciate about serendipity.

If you just use the template for your own, you can use "{$serendipityBaseURL}templates/mytheme/img/bla.gif" of course.

Regards,
Garvin
# Garvin Hicking (s9y Developer)
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
DarKRaveR
Regular
Posts: 20
Joined: Wed Mar 29, 2006 7:35 am
Location: FFM, Germany

Post by DarKRaveR »

Okay, thanx, I'd rather keep it generic ... and yes it makes sense havin a function then (concerning the nesting) - I simply forgot about that ...
Post Reply