[ZPT] how can I avoid path to grow huge ??

Dieter Maurer dieter@handshake.de
Wed, 1 May 2002 21:15:07 +0200


Robert Rottermann writes:
 > Thanks dieter,
 > As you can see, I am using only relative paths.
 >         <a href="scripts/showGardenPage?roomnr=gd"
 >            tal:content="structure python:here.scripts.worte('selection',
 > 'gd')">
I said "simple relative" and explained "without containing '/'".

Your path is relative but not simple: there is this "/" between
"scripts" and "showGardenPage"...

 > changing it to (adding tall:attributes):
 >         <a href="scripts/showGardenPage?roomnr=gd"
 >            tal:attributes="href python:'%s/showGardenPage?roomnr=gd' %
 > here.scripts.absolute_url()"
 >            tal:content="structure python:here.scripts.worte('selection',
 > 'gd')">
 >           Garten-Dekoration
 >         </a>
 > works but seems convoluted and I fail to understand why it is neccessary.
When you would read the "Web Publishing" section of

  <http://www.dieter.handshake.de/pyprojects/zope/book/chap3.html>

you might understand:

  When you use any relative reference, the browser adds the
  documents base reference.

  The base reference is either explicitly specified in the document
  with a "base" tag in the HTML "head" element or derived
  by the browser from the document URL (by stripping from right
  to the last '/').

This gives your the following options:

  *  live with the path lengthening

  *  avoid "/" in relative references

  *  set the base tag appropriately (not easy)

  *  use absolute URLs


Dieter