[opencms-dev] Dynamic rewrite of links in HTML file?

Alexander Langer al at al-arenal.de
Wed Jan 21 15:45:02 CET 2004


Hi Olli!

I'm not worried about my templates and the links within, cause I'm
running a system which uses different template sets. These templates
include the html files which contain the content. Now I have to find a
way to take the static html content and change some of the links
within. Therefore I need to know a way of reading in the html file
into a string. That's all I need cause then I can process the html
code the way I want to and rearrange things as needed.

The alternative would be, that the user would have to maintain the
same content in different html files and in a good CMS there should be
no reason for such a thing.

> Hi Al,

> The code below will give you a content for the file type page. However, I
> assume you use template elements for creating your navigation and therefore
> you should also filter your links within your navigation elements (Parsing
> the page content would not help you to modify those links, since it returns
> only the content item and possible static links you might have with it).

> Regards,

> Olli

> CmsFile reqFile=cms.getCmsObject().readFile(fileURI);
> CmsXmlControlFile ctl=new CmsXmlControlFile(cms,reqFile);
> CmsElementDefinitionCollection
> collection=ctl.getElementDefinitionCollection();
> CmsElementDefinition def=collection.get("body");
> CmsXmlTemplateFile template=new
> CmsXmlTemplateFile(cms,def.getTemplateName());
> String content=template.getProcessedDataValue("TEMPLATE");

>> -----Original Message-----
>> From: opencms-dev-admin at opencms.org
>> [mailto:opencms-dev-admin at opencms.org]On Behalf Of Alexander Langer
>> Sent: 19 January 2004 02:42
>> To: opencms-dev at opencms.org
>> Subject: [opencms-dev] Dynamic rewrite of links in HTML file?
>>
>>
>>
>> following structure:
>>
>> /a.jsp includes /html/a.html
>> /b.jsp includes /html/b.html
>> ...
>>
>> For some reason I need a mechanism to read the html file into a
>> string, change some <a ...> tags (add a parameter to the url) and then
>> output the changed string.
>>
>> problem:
>> I can't even figure out how to read a vfs file into a string.
>>
>> Any suggestions/solutions?
>>
>>
>> Thanks,
>> al
>>
>> --
>> Alexander Langer
>> homepage: http://www.al-arenal.de
>> mailto: langer at al-arenal.de
>>
>>
>> _______________________________________________
>> This mail is send to you from the opencms-dev mailing list
>> To change your list options, or to unsubscribe from the list, please visit
>> http://mail.opencms.org/mailman/listinfo/opencms-dev
>> ---
>> Incoming mail is certified Virus Free.
>> Checked by AVG anti-virus system (http://www.grisoft.com).
>> Version: 6.0.561 / Virus Database: 353 - Release Date: 13/01/2004
>>
> ---
> Outgoing mail is certified Virus Free.
> Checked by AVG anti-virus system (http://www.grisoft.com).
> Version: 6.0.561 / Virus Database: 353 - Release Date: 13/01/2004

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



al

-- 
Alexander Langer
homepage: http://www.al-arenal.de
mailto: langer at al-arenal.de





More information about the opencms-dev mailing list