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

Paul-Inge Flakstad flakstad at npolar.no
Fri Dec 2 10:40:21 CET 2016


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

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://webmail.opencms.org/pipermail/opencms-dev/attachments/20161202/304c27b1/attachment.htm>


More information about the opencms-dev mailing list