RE: [SMARTY] Paths in templates
| From: | Monte Ohrt | Date: | Mon, 03 Feb 2003 18:00:34 +0000 |
| Subject: | RE: [SMARTY] Paths in templates | ||
| References: | 1 | Groups: | php.smarty.general |
| Request: | Send a blank email to php-smarty-general+get-7481@lists.php.net to get a copy of this message | ||
Another method is to use a template function:
{image name="myimage.jpg"}
this will get compiled into:
<img src="/images/myimage.jpg">
or:
<img src="/development/images/myimage.jpg">
The application figures out the image path depending on
development/production environment, but the templates look
the same in both.
Monte
On Mon, 2003-02-03 at 11:04, SavaJr wrote:
> Hello Ferdinand
>
> Absolutely agree with you regarding the development practices on URI and
> local fylesystem PATH etc.
>
> The main disadvantage of smarty templates for designer is that he
> doesn't see the graphics while working in subdirs or should copy file
> each time into root dir (or change their paths like ../ or so)
>
> The solution for development time is creating symlinks from smarty
> templates dir.
>
> The filesystem structure is:
>
> ROOT
> ------
> Img
> Css
> Templates
> |----img -> ../img
> |----css -> ../css
> |----template.html will look same in root and template dir.
> Some_dir
>
> Script.php
>
> Another advantage is that we don't need things like
> <a href="{$URIs.root}"><img src="{$URIs.images}home.gif"
> /></a>
> Simple <base> tag makes things, even say more - it is not required at
> all.
>
> ---------------
> Ruslan Savchyshyn
> http://www.MagneticOne.com/
> Web development and design services
>
>
> -----Original Message-----
> From: Ferdinand Beyer [mailto:fbeyer@clickhand.de]
> Sent: Monday, February 03, 2003 6:37 PM
> To: savajr@avalon.te.ua
> Cc: smarty-general@lists.php.net
> Subject: RE: [SMARTY] Paths in templates
>
>
> On 3 Feb 2003 at 17:41, SavaJr wrote:
>
> > On unix you can also make symlinks in templates dir, to original dirs.
>
> > Like
> >
> > Templates
> > - img -> ../img/
> >
> > It helps while developing
>
> Im my experience it is the best practice to use absolute uris like
> /images or /index.php. I usually define a constant with the
> ROOT_URI during development so that my apps can be run in a sub
> directory - e.g. /projects/xyz/. In production I simply set this
> ROOT_URI to /.
>
> For Smarty I assign an array with uris for important directorys like the
>
> root or the images directory:
>
> <a href="{$URIs.root}"><img src="{$URIs.images}home.gif"
> /></a>
>
> HTH
>
> --
> Ferdinand Beyer
> <fbeyer@clickhand.de>
>
>
> --
> Smarty General Mailing List (http://smarty.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
--
Monte Ohrt <monte@ispi.net>