[opencms-dev] newbie: parse & modify generated page

Y. Glebov yglebov at eclipse-sp.com
Wed Aug 16 17:59:45 CEST 2006


Hi.
I had the same problem with contentload tag, before discovering contentload
scriptlet methods :)
I solved it with Jakarta taglibs - taglib "String" allows you to substitute
parameters after output, like this:

<string:replace replace=":" with="</td><td>">
<cms:contentshow />
</string:replace>

This code replaces all ":" symbols in content with "</td><td>"

Jakarta taglibs are available here:
http://jakarta.apache.org/taglibs/

and some of them (including String) requires common taglib that is available
here:

http://www.ibiblio.org/maven2/commons-lang/commons-lang/2.1/commons-lang-2.1
.jar

Have a nice try.

Yuriy Glebov.


-----Original Message-----
From: opencms-dev-bounces at opencms.org
[mailto:opencms-dev-bounces at opencms.org] On Behalf Of Gerhard Erich Bruckner
Sent: Wednesday, August 16, 2006 6:25 PM
To: The OpenCms mailing list
Subject: Re: [opencms-dev] newbie: parse & modify generated page

thanks for the comments. let me reformulate once more:

is there any way of post-processing the output of e.g.
cms.include( null, "body" ) ?

the context: i want to add a filter that substitutes certain text nodes 
(if content matches regular expression) for nodes of other type 
(<acronym>, <a>, ...) after the page is assembled -> to force
the content authors to have their abbreviations explained 
without interfering with their sources!

i have a prototype javascript that performs very poorly - for that reason 
i would like to have it done on the server-side.

we use opencms VERSION 5

thx,
gerhard

On Mon, 14 Aug 2006, Shi Yusen wrote:

> Hi Gerhard,
> 
> What does elegant way mean? Generally, you can parse the page with jTidy.
> You can download a weather module for OpenCms 5.0 (sorry, I cann't
remember
> the url for this module) and see what it does.
> 
> Regards,
> 
> Shi Yusen/Beijing Langhua Ltd.
> --------------------------------------------------------------
> Tel: 86-10-88514088, 88514099
> Fax: 86-10-88514099
> Email: shiys at langhua.cn
> Website: http://www.langhua.cn/
> --------------------------------------------------------------
>  
> -----????-----
> ???: opencms-dev-bounces at opencms.org [mailto:opencms-dev-bounces at opencms.
> org] ?? Gerhard Erich Bruckner
> ????: 2006?8?14? 18:34
> ???: opencms-dev at opencms.org
> ??: [opencms-dev] newbie: parse & modify generated page
> 
> hi there!
> 
> does anyone know of an elegant way of parsing and modifying the 
> already-generated DOM of an HTTP-response (for a certain project) before 
> returning the result to the browser?
> 
> from my understanding, that can only be done in the somewhere close
> to the main servlet. (the controller in MVC terms)
> 
> any ideas? (for version 5)
> 
> thx!
> 
> _______________________________________________
> This mail is sent to you from the opencms-dev mailing list
> To change your list options, or to unsubscribe from the list, please visit
> http://lists.opencms.org/mailman/listinfo/opencms-dev
> 
> 
> _______________________________________________
> This mail is sent to you from the opencms-dev mailing list
> To change your list options, or to unsubscribe from the list, please visit
> http://lists.opencms.org/mailman/listinfo/opencms-dev
> 

_______________________________________________
This mail is sent to you from the opencms-dev mailing list
To change your list options, or to unsubscribe from the list, please visit
http://lists.opencms.org/mailman/listinfo/opencms-dev




More information about the opencms-dev mailing list