[Zope] slicing absolute_url

Casey Duncan casey@zope.com
Fri, 9 Aug 2002 12:36:00 -0400


On Friday 09 August 2002 11:08 am, Sir K wrote:
> Hi,
>=20
> <dtml-let article=3Dabsolute_url>
> <dtml-var article>
> </dtml-let>
> <a href=3D"&dtml-absolute_url;"> more </a>
>=20
> With the code above I was able to display absolute_url through var
> article, but I was unable to slice the var article to extract out the t=
ext
> i needed with this code.
>=20
> <dtml-let article=3Dabsolute_url>
> <dtml-var expr=3D"article[50:9]">

The python slicing syntax is: stringvar[start:end]

If start > end then you always get an empty string (unless end is negativ=
e=20
which means "from the right").

> </dtml-let>
> <a href=3D"&dtml-absolute_url;"> more </a>
>=20
> I need somebody to please help me out of this problem.

What is it you are trying to slice out of the URL, the name of the parent=
 or=20
something? Quite frankly the concept you have presented scares me ;^) The=
re=20
is likely a better way that doesn't involve slicing the URL.

Please let us know what you are trying to do (rather than just throw brok=
en=20
code at us) and maybe we can help you better.

-Casey