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

Olli Aro olli_aro at yahoo.co.uk
Wed Jan 21 15:53:00 CET 2004


Ok, well the code I posted you before does give you the content item as
string based on uri as resource locator. Does this work for you?

Olli

> -----Original Message-----
> From: opencms-dev-admin at opencms.org
> [mailto:opencms-dev-admin at opencms.org]On Behalf Of Alexander Langer
> Sent: 21 January 2004 14:44
> To: Olli Aro
> Subject: Re[2]: [opencms-dev] Dynamic rewrite of links in HTML file?
>
>
> 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");
>

>
---
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





More information about the opencms-dev mailing list