Server-Side DOM on Cached Templates?

Do you have a question? Post it now! No Registration Necessary.  Now with pictures!

Threaded View

The idea is to generate server-side cached copies of default-value pages
and manipulate them via DOM for individual user requests. Kind of a
client-side Javascript approach, only that I would like to apply changes
_before_ sending the page to the client.

I have looked at PHP's XML and DOM features, and it looks as if those will
allow me to manipulate XML trees before generating client-specific
output. Apart from issues that might arise from a switch to an entirely
XML-based setup (is Xforms really there yet? SQL to XML? XSLT?), I would
like to avoid the overhead of generating pages anew every time some minor
change in content or layout occurs.

Does this make sense? If yes, is there anything out there that uses
this approach? How about potential problems and trade-offs?

I'm not married to PHP, so addtional pointers and references to other
languages are most welcome.



f'up comp.lang.php

Re: Server-Side DOM on Cached Templates?

Pretty interesting stuff..

I guess you will have problems if the client browser does not accept
javascripts and have them turned off..

Re: Server-Side DOM on Cached Templates?


Quoted text here. Click to load it

Well, that's why I want to handle this server-side. I already use
Javascript to provide/change some _non_ vital information via DOM on the
client's side; this is actually where my initial idea came from.

Right now, I am dealing with a CMS that requires a lot of data structure
mangling and chopping. Form control 'label', 'class', and 'value'
attributes need to be changed according to view, involving a lot of
processing overhead for even minor changes. It would be nice to have a
complete default (document) tree somewhere in memory that could be
manipulated using some kind of DOM API.

Apparently, there are already a couple of tools out there that can do the
job in PHP (XML and DOM functions, Sablotron for XSLT processing).
However, I cannot seem to find a comprehensive development framework and,
most important, feedback from the trenches...



Site Timeline