Smarty - what is relative template path?

Discussion corner for Developers of Serendipity.
Post Reply
Don Chambers
Regular
Posts: 3652
Joined: Mon Feb 13, 2006 2:40 am
Location: Chicago, IL, USA
Contact:

Smarty - what is relative template path?

Post by Don Chambers »

I have installed s9y dozens of times, and never once have I changed the default value for the relative template path (templates/)... but someone COULD. In various templates, this could be a problem. For instance, in bulletproof, we load certain images as follows:

Code: Select all

src="{$serendipityHTTPPath}templates/{$template}/img/image.png"
This would not work should a user change their configuration for the relative template path to anything other than "templates/". I do not see a variable holding the relative template path (nor any of the other configurable paths other than baseURL). Are these available via smarty?
=Don=
garvinhicking
Core Developer
Posts: 30022
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Re: Smarty - what is relative template path?

Post by garvinhicking »

Hi!

Indeed, this is a problem. Actually, the suggested way to get a relative image file is to use serendipity_getFile, because that one takes the templatePath value into accordance.

Could this be done in BP? Or where does $template come from?

The templatePath variable is not put to Smarty by default, so the BP config.inc.php might need to do that assignment of $serendipity['templatePath']...

HTH,
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/
Don Chambers
Regular
Posts: 3652
Joined: Mon Feb 13, 2006 2:40 am
Location: Chicago, IL, USA
Contact:

Post by Don Chambers »

We did this a LONG time ago, but we actually use both methods, including:

Code: Select all

src="{serendipity_getFile file="img/image.png"}"
Could it be that part of the reason is that we needed to prepend the colorset name to the image file name, and we could not do that using serendipity_getFile???? ie, this is what bp is using for previous/next images:

Code: Select all

<img alt="{$CONST.NEXT_PAGE}" title="{$CONST.NEXT_PAGE}" src="{$serendipityHTTPPath}templates/{$template}/img/{$template_option.colorset}_forward.png" />
And I have no idea where {$template} came from - perhaps it evolved when we were working on bp as we realized bp was to be a framework for creating other templates, so we would not know the final template's name/folder????
=Don=
Post Reply