Re: [SMARTY] problems with using paths in my templates
| From: | Michal Prinke | Date: | Mon, 15 Jul 2002 21:52:45 +0000 |
| Subject: | Re: [SMARTY] problems with using paths in my templates | ||
| References: | 1 | Groups: | php.smarty.general |
| Request: | Send a blank email to php-smarty-general+get-5324@lists.php.net to get a copy of this message | ||
Peter Billen wrote:
> So, this works:
> <img src="/templates/default/images/bla.jpg">
> but this doesn't
> <img src="images/bla.jpg">
I had the same problem, too... in my opinion, it would be clean and tidy
to keep Smarty templates together with graphics files, CCS' and stuff -
apart from PHP scripts. Templates, pictures and style definitions take
care of the design, when PHP does the logic.
So, I distinguished the following path types:
* TEMPLATE-2-TEMPLATE: {include file=dir1/aaa.tpl};
* TEMPLATE-2-STATIC FILE: <img src="dir2/aaa.jpg">;
* TEMPLATE-2-SCRIPT: <a href="dir3/aaa.php">;
Every time I construct a Smarty object, I pass those dirs and use them
later like this: <img src="{$dir2}/aaa.jpg">.