Re: Declarative URL's - Workaround

Thorsten Weber <[email protected]> Tue, 14 Sep 2010 17:16:16 +0200
Newsgroups gmane.comp.cms.zms.devel
Message-ID <[email protected]>
Hi Thimo

I tried your script ... but unfortunately it only return ZMS_THIS as content ...

Any advice how to handle this?

regards, Thorsten


Am 13.07.2010 um 14:52 schrieb Thimo Kraemer:

> Am Fri, 24 Aug 2007 16:12:33 +0200 hat Rudolf Bumm <[email protected]> geschrieben:
> 
>> Hi,
>> We switched in a ZMS website to declarative URL's. This worked. URLs are
>> now in the long format and clicks on the menu entries results in display
>> of the selected page with a declarative URL.
>> 
>> Problem 1:
>> However, when we implement a HTML link from a text page element by help
>> of the standard text editor (or XHTML and xstandard), the resulting link
>> is again non-declarative (/e153/index_ger.html) and clicking on this
>> link shows the correct page, but with a non-declarative URL.
>> Is there anything else needed for making editor-links within the ZMS
>> website work declarative ?
>> ZMS 2.10.
>> Declarative ULR is on, Crop URL was off, Coherent URL was off.
>> Problem persists whe switching Crop URL on and Coherent URL on.
> 
> Create a Python-Script called "getCustomBodyContent" with
> two parameters "html, REQUEST" and the following script:
> 
> try:
>     start = 'href="./'
>     end = '"'
>     while True:
>         i = html.find(start)
>         j = html.find(end, i+len(start))
>         if i < 0 or j < 0:
>             break
>         href = html[i+len(start):j]
>         ids = href.split('/')
>         ids[-1:] = ids[-1].split('#')
>         ob = REQUEST['ZMS_THIS']
>         for id in ids:
>             if not id or id.startswith('index'):
>                 continue
>             if id == '..':
>                 ob = ob.getParentNode()
>             else:
>                 ob = getattr(ob, id, None)
>             if not ob:
>                 # Invalid href
>                 href_new = href
>                 break
>         else:
>             href_new = ob.getHref2IndexHtml(REQUEST)
>         html = html.replace('./'+href, href_new)
> 
>     return html
> 
> except Exception, err:
>     return err
> 
> 
> 
> Regards
> Thimo
> 
> 
> ------------------------------------
> 
> Yahoo! Groups Links
> 
> 
>