Page 1 of 1

Smarty - what is relative template path?

Posted: Tue Jul 29, 2008 3:14 pm
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?

Re: Smarty - what is relative template path?

Posted: Tue Jul 29, 2008 3:21 pm
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

Posted: Tue Jul 29, 2008 3:41 pm
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????