[opencms-dev] Allow links to non-existing resources

Lorenz Lammersdorf lorenz.lammersdorf at kernbrand.ch
Fri Dec 2 11:02:15 CET 2016


maybe i've misunderstood your approach, but why do you need links? i'd build a xml scheme linke this:


<xsd:element name="externalResourceLanguage" type="OpenCmsString" />

<xsd:element name="externalResourcePool" type="OpenCmsString" />

<xsd:element name="externalResourceIdentifier" type="OpenCmsString" />


<layout element="externalResourceLanguage" widget="SelectorWidget" configuration="en | klyngon | l33t | whatever" />

<layout element="externalResourcePool" widget="SelectorWidget" configuration="people | dogs | cats | penguins" />


and based on this i'd "manufacture" the link in the template. of course it's a little more work for your editors, but you get rid of the whole dummy folders and files.

________________________________
Von: opencms-dev-bounces at opencms.org <opencms-dev-bounces at opencms.org> im Auftrag von Paul-Inge Flakstad <flakstad at npolar.no>
Gesendet: Freitag, 2. Dezember 2016 10:40:21
An: The OpenCms mailing list
Betreff: [opencms-dev] Allow links to non-existing resources

Hi all,

Our OpenCms site integrates some externally stored content - for example, person details (name, email, phone, etc.). I'll use this example to explain.

Each person page has a unique, human-friendly URI, like "/en/people/jane.doe/".

Up until now, we've employed one dummy folder + index file in the VFS for every person. These are just empty resources; all the magic happens in the index file's template, which uses the ID found in the URI (e.g. "jane.doe") to fetch the externally stored content and render the page.

This approach works great with respect to the internal workings of OpenCms, but it's not very efficient. In an attempt to remedy that, I decided to write a resource initializer for requests to stuff inside the "/en/people/" folder. It works great. All our person URIs work - they are in fact unchanged - with only the folder "/en/people/" existing in the VFS.

Finally we can get rid of those unnecessary dummy resources!

...there's just this tiiiny little problem...

Links won't work anymore(!!!). At least not link fields in xmlcontent - imagine f.ex. a dedicated field called "Author" or "Contact person".

Naturally, once all the dummy stuff is gone, adding a link to "/en/people/######" will produce an error. "Invalid reference, the resource can not be found." And it's correct, of course; the ###### resource doesn't exist in the VFS. I'd still like to save the link, though.

Is there a way to circumvent this problem? Or am I forced to handle the issue another way? (I have good ideas on how to, but they would require modifying all existing links - and we have thousands of pages...)
Thanks in advance,
Paul




Lorenz Lammersdorf
Entwickler
+41 58 255 13 06

Aktuell im Blog: Social Media im B2B: Eine grosse Chance f?r Ihr Unternehmen<http://mensch-marke.info/social-media-b2b-gruende/>

Kernbrand AG
Teufener Strasse 11
9000 St. Gallen
www.kernbrand.ch<https://kernbrand.ch>

Folgen Sie uns: Facebook<http://bit.ly/Kernbrand_Facebook> | Pinterest<http://bit.ly/Kernbrand_Pinterest> | LinkedIn<http://bit.ly/Kernbrand_LinkedIn1> | Twitter<http://bit.ly/Kernbrand_Twitter> | Youtube<http://bit.ly/Kernbrand_Youtube>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://webmail.opencms.org/pipermail/opencms-dev/attachments/20161202/34723342/attachment.htm>


More information about the opencms-dev mailing list