[Zope3-dev] Re: Apache rewrite rules and URLs: an experiment
Jim Fulton
jim at zope.com
Mon Nov 1 08:52:58 EST 2004
Peter Mayne wrote:
> Stephan Richter wrote:
>
>> What about using: <a tal:attributes="href context/@@/z3logo.gif">
>>
>> I think this is the recommended way; will it do the right thing?
No
> I looked at this a little bit more. Obviously, this is context relative,
> so if I'm using this template one folder down, I have to change the URL
> to "context/../@@/z3logo.gif". Therefore, this won't work in a template
> that is used at different folder depths.
>
> This makes me wonder why I would use "context/path" at all, when just
> "path" is both easier to type (fewer keystrokes), and produces a shorter
> URL in the output.
>
> So, we're back to my original proposition: use relative paths where
> possible, and "request.getApplicationURL(path_only=True) + path" where
> an absolute path is required. No other URL in a template is correct.
>
> Comments?
You want:
<a tal:attributes="href context/++resource++z3logo.gif">
++resource++name gets a resource *object*. When it is converted to
a string by tal:attributes, an absolute URL is computed based on
the location of the enclosing site.
Jim
--
Jim Fulton mailto:jim at zope.com Python Powered!
CTO (540) 361-1714 http://www.python.org
Zope Corporation http://www.zope.com http://www.zope.org
More information about the Zope3-dev
mailing list