[opencms-dev] allowRelativeLinks - Can someone explain?

Frans Postma fpostma at xs4all.nl
Mon Mar 14 22:48:09 CET 2005


Oh yes, that I *can* explain :-) Didn't spend an hour or so searching through the editor code for nothing :)

You add a property ("define..." button on Advanced, properties panel), call it "allowRelativeLinks" and give it the value "true".

Note that this ONLY concerns how files are changed by opencms after they have been edited. It has NOTHING to do with
cms.link()/cms:link handling !! 

You can test/see this behaviour by making a new testpage (xmlpage). Edit it using the source-editor, add a link to something like
this:
	<P><A href="bla_link" target=_self>blas</A></P>

Now click on the Clean-Up-HTML button of the editor. You'll see that the link gets expanded to: 
	<p><A href="/opencms/opencms/bla_link" target=_self>blas</a></p>. 

That is what can be prevented using allowRelativeLinks. Effectivly you let the webserver do the link resolving. Easiest would be
if opencms simply wouldn't touch url/href's starting with either / or ./

Greetings,

Frans

> -----Original Message-----
> From: opencms-dev-bounces at opencms.org 
> [mailto:opencms-dev-bounces at opencms.org] On Behalf Of Barry
> Sent: maandag 14 maart 2005 21:39
> To: The OpenCms mailing list
> Subject: [opencms-dev] allowRelativeLinks - Can someone explain?
> 
> The use of allowRelativeLinks is mentioned here; how exactly does this
> work? Do you simply add this property, or is there more to it to get
> this working.
> 
> I'd love to see a way of disabling this absolute path thing 
> globally too
> - it's been driving me mad.
> 
> Regards, Barry.
> 
> Frans Postma wrote:
> 
> >Hi,
> >
> >I've discovered that opencms by default hardcodes all 
> cms-paths to absolute upon saving a file and exiting the 
> editor for it. That
> >is not what I want so I need to set allowRelativeLinks as a 
> page-property. Easy enough to do, however I want to have that set to
> >true for ALL pages generated.
> >
> >I tried adding it to the template I use, but that doesn't 
> have much effect. The property-NAME is now in those pages but 
> the value
> >is undefined (i.e. value is not inherited from template).
> >
> >I can modify CmsNewResourceXmlPage.java to suit my means, by 
> simple adding an extra property upon creating of a page, but I would
> >prefer NOT to modify core-code for something simple like this.
> >
> >Any ideas how to accomplish this without editing java files 
> for every propery change needed?
> >(is there ANY way to have pages inherit property values from 
> *somewhere* ??)
> >
> >Greetings,
> >
> >Frans
> >
> >
> >
> >_______________________________________________
> >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
> >
> >  
> >
> 
> 
> 
> 
> 
> _______________________________________________
> 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
> 




More information about the opencms-dev mailing list