[Zope] absolute urls

Jim Fulton jim@digicool.com
Thu, 10 Feb 2000 10:27:36 -0500


Ragnar Beer wrote:
> 
> Hi everyone!
> 
> In the robots and spiders tip it says:
> 
> "... but its probably better to specify absolute URLs."
> 
> I wonder if there is a way in zope to specify absolute urls but still
> be able to transfer a whole branch of the website using copy/cut and
> paste without messing up the links. Anybody done that?

Sure, you just call absolute_url on the object, or, you can use the
var tag option to do that, or, you can use the URL entity reference.

For example, suppose you want to provide a URL to 'X', which
may come from a variety of places.  You can use any of:

  <dtml-var expr="X.absolute_url()">

or 

  <dtml-var X url>

or

  &dtml.url-x;

All of these are equivalent, and the last is probably the best, 
since it is short and is handly when used in a tag attribute, as
in:

  <a href="&dtml.url-x;">See X</a>

Jim

--
Jim Fulton           mailto:jim@digicool.com   Python Powered!        
Technical Director   (888) 344-4332            http://www.python.org  
Digital Creations    http://www.digicool.com   http://www.zope.org    

Under US Code Title 47, Sec.227(b)(1)(C), Sec.227(a)(2)(B) This email
address may not be added to any commercial mail list with out my
permission.  Violation of my privacy with advertising or SPAM will
result in a suit for a MINIMUM of $500 damages/incident, $1500 for
repeats.