I think the easiest solution would be to have your designers type src="/images/logo.jpg"href="/css/wiw.css", etc. and then put the respective files in the directories

/Users/mysilmaril/Sites/WIW/images /Users/mysilmaril/Sites/WIW/css

(with /Users/mysilmaril/Sites/WIW/ being the webserver's configured document root)

In this case, no additional mapping of path components like /images —> /assets/images would be required (via TT2 [% images %] or whatever).

If you can't get your designers to type anything other than src="/logo.jpg", you could set up a RewriteRule to prepend /assets/images to any URI-path that ends in .jpg, .png, .gif, etc.

P.S.: if you're going to use

[% root = '/Users/mysilmaril/Sites/WIW' images = '$root/assets/images" %] ... <img src="[% images %]/logo.jpg">

I'm pretty sure you don't want the /Users/mysilmaril/Sites/WIW part in there, as the image would then (most likely) be searched under

/Users/mysilmaril/Sites/WIW/Users/mysilmaril/Sites/WIW/assets/images/

In reply to Re^3: Template Toolkit Question by almut
in thread Template Toolkit Question by Perobl

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.