Re: [SMARTY] problems with using paths in my templates
| From: | Ben Godfrey | Date: | Tue, 16 Jul 2002 02:12:44 +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-5331@lists.php.net to get a copy of this message | ||
Keeping the templates and the media files in the same place wouldn't work. The templates are processed and dispatched via Smarty, whereas the media is requested directly by the browser. It's conceivable that somebody might download your template files, even if they didn't the association is an artificial one.
I don't think there's any one total solution to organising the directory structure of a Smarty application, but I've found that keeping as few a files as possible inside the web root at least prevents the confusion from spreading to the user. I've also found that using Apache's mod_rewrite to build my URL interface very useful.
Regards,
Ben
On Monday, July 15, 2002, at 10:52 , Michal Prinke wrote:
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">. -- Smarty General Mailing List (http://smarty.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php