[opencms-dev] Dynamic rewrite of links in HTML file?
Alexander Langer
al at al-arenal.de
Thu Jan 22 19:57:01 CET 2004
Ah, that works!
Thank you very much!
al
> Well, it was just a code-snip to show the principle and what classes you
> need to use in order to read the content in a string. Below is the code-snip
> with the correct class references. You can paste it in an empty JSP and you
> should see the content.
> Regards,
> Olli
> <jsp:useBean id="cms"
> class="com.opencms.flex.jsp.CmsJspActionElement"><%cms.init(pageContext,
> request, response);%></jsp:useBean><%
> String fileURI="/mydirectory/myfile.html";
> com.opencms.file.CmsFile reqFile=cms.getCmsObject().readFile(fileURI);
> com.opencms.template.CmsXmlControlFile ctl=new
> com.opencms.template.CmsXmlControlFile(cms.getCmsObject(),reqFile);
> com.opencms.template.cache.CmsElementDefinitionCollection
> collection=ctl.getElementDefinitionCollection();
> com.opencms.template.cache.CmsElementDefinition def=collection.get("body");
> com.opencms.template.CmsXmlTemplateFile template=new
> com.opencms.template.CmsXmlTemplateFile(cms.getCmsObject(),def.getTemplateNa
> me());
> String content=template.getProcessedDataValue("TEMPLATE");
%>><%=content%>
>> -----Original Message-----
>> From: opencms-dev-admin at opencms.org
>> [mailto:opencms-dev-admin at opencms.org]On Behalf Of Alexander Langer
>> Sent: 22 January 2004 17:20
>> To: Olli Aro
>> Subject: Re[4]: [opencms-dev] Dynamic rewrite of links in HTML file?
>>
>>
>> I'm only getting a lot of "cannot resolve symbol" error messages. What
>> do I have to import to make the code work?
>>
>> > 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
>>
>>
>> > _______________________________________________
>> > 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
>>
>>
>> _______________________________________________
>> 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