[Zope] slicing absolute_url

Chris Withers chrisw@nipltd.com
Sat, 10 Aug 2002 11:49:49 +0100


Sir K wrote:
>>What is it you are trying to slice out of the URL, the name of the
>>parent or 
>>something? Quite frankly the concept you have presented scares me ;^)
>>There 
>>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
>>broken 
>>code at us) and maybe we can help you better.
>>
>>-Casey
> 
> 
> Thanks Casey,
> 
> I made silly mistake by making start > end. I feel sorry for myself !
> 
> Anyway what I was trying to do is this;
> I have a DTML Method that search a Zcatalog to return all the Dtml Docs
> with id matching var mm. I was able to display the absolute_url of these
> Docs without any stress. Then there is need for me to get some of the Docs
> and display at least some paragraphs b4 pointing the absolute_url to the
> their details.These docs are inside subfolders which are in the same level
> as the DTML Method.

So, the documents are being returned via a ZCatalog search?

Try this:

<dtml-call "REQUEST.set('mm',
ZopeTime().toZone('GMT+1').strftime('%d%m%y'))">

<dtml-in "Zcat_Index_Dtml_doc(id=mm)">
<dtml-var expr="getObject[0:400]">...<br>
<a href="&dtml-getURL;"> more </a>
</dtml-in>

...note that this uses the getObject and getURL methods that ZCatalog 
search results normally have.

cheers,

Chris