I seem to be reading circles, or maybe I just donโt understand some of the concepts here. I am processing a set of PHP template classes that previously used some fancy regular expressions to combine and duplicate documents and document areas, creating an output page. An example of my previous method (for completeness):
<div id="myId"> <div class="myClass"> <h1>{{ var:myHeading }}</h1> <h2>{{ var:myDatetime format:datetime(Ymd H:i:s) }}</h2> <p>{{ var:myText format:maxLength(300) }}</p> </div> </div>
In any case, it works very well, but I really want to move it to the next level and realized that it would logically expand the markup, becoming something like:
<div id="myId"> <zuq:region name="myRegion"> <div class="myClass"> <h1><zuq:var name="myHeading" /></h1> <h2><zuq:var name="myDatetime" format="datetime" param="Ymd H:i:s" /></h2> <p><zuq:var name="myText" format="maxLength" param="300" /></p> </div> </zuq:region> </div>
I read W3 specifications and even W3Schools tutorials on various related technologies, such as XML Schema for writing template specifications. Obviously, I want everything to be well-formed and work in all the used namespaces. This will primarily be used with XHTML markup.
In any case, can anyone point me to a good read on understanding XML namespaces , constraints, and best practices for mixing namespaces , and, most importantly, I suppose working with PHP / DOM / XML . Are there any critical flaws in my approach that everyone can see? PHP doesn't seem to have a particularly powerful implementation for working with markup documents with names, either through DOMDocument (and siblings) or SimpleXML .
Any advice, suggestions for reading or criticism are welcome!
Edit: in case anyone is interested, elements from the zuq namespace should not be present during the output of the output, parsed and otherwise removed. However, in addition to the good practice of storing documents, I intend to take advantage of the markup present in the templates, so that administrators can quickly edit pages through the CMS WYSIWYG editor.