[opencms-dev] Absolute links in OpenCmsHtml fields

Paul-Inge Flakstad flakstad at npolar.no
Thu Aug 5 09:34:57 CEST 2010


Hi Mario,

Thank you for a very informative answer. I eventually solved the 
issue in my template instead.

On a couple of previous occasions, I have had the same question in 
mind - perhaps an option not to replace links could be considered 
added as a config option in a future version? Such an option would 
be handy when using an OpenCmsHtml field to define text that is 
not displayed on the site, but somewhere else; for example text in 
an outgoing e-mail. In that case, only absolute links will do.

Best regards,
Paul

> -----Original Message-----
> From: opencms-dev-bounces at opencms.org 
> [mailto:opencms-dev-bounces at opencms.org] On Behalf Of Mario Jäger
> Sent: 5. august 2010 09:12
> To: The OpenCms mailing list
> Subject: Re: [opencms-dev] Absolute links in OpenCmsHtml fields
> 
> Hi Paul,
> 
> It is not possible to switch off the link substitution in the 
> OpenCmsHtml field by any configuration.
> 
> The link substitution in the OpenCmsHtml field happens in the 
> class org.opencms.xml.types.CmsXmlHtmlValue in the methods 
> createStringValue() (called in getStringValue()) and 
> setStringValue() through the usage of the methods processLinks() and 
> replaceLinks() of the link processor (class 
> org.opencms.staticexport.CmsLinkProcessor). 
> 
> You could try to create a new field which works analogue to 
> the OpenCmsHtml field, but which doesn't substitute the links. 
> Thereto, you have to create a new class which extends the 
> class org.opencms.xml.types.CmsXmlHtmlValue and which overwrites 
> the methods getStringValue(), createStringValue() and 
> setStringValue(). But, you should create that class in your 
> own module. 
> Because, then there is nothing overwritten when you update 
> your OpenCms.
> 
> This new field you have to you use in these xsd files of 
> these xml contents, where the link substitution should not happen.
> 
> -- 
> Kind Regards,
> Mario.
>  
> -------------------
> Mario Jäger
>  
> Alkacon Software GmbH  - The OpenCms Experts                    
> http://www.alkacon.com - http://www.opencms.org
> 
> 
> Paul-Inge Flakstad schrieb:
> > Hi list,
> >  
> > In an OpenCmsHtml field in a structured content resource 
> type, I need 
> > to provide an absolute link to another resource in the VFS.
> >  
> > Is there any way to disable the automatic link substitution done by 
> > OpenCms?
> >  
> > For example: 
> >  
> > I enter this link:
> >     <a 
> href="http://mysite.com:8080/opencms/opencms/en/page.html">link</a>
> > and need to keep it like it is, but OpenCms modifies it 
> into this link:
> >     <a href="/en/page.html">link</a>
> >  
> >  
> > Best regards,
> > Paul
> > 
> --------------------------------------------------------------
> ----------
> >
> >
> > _______________________________________________
> > 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