News RSS

DOMTemplate Repository Moved

Posted on 2014-01-30 19:50:00 by Admin

It has happened the DOMTemplate sources are now on Github and will be maintained there. Along with this change we have also implemented the new PHP namespace system along with the composer package system.

Checkout the new code from

DkWiki 2.1 - Its Back The DkWiki

Posted on 2012-08-15 09:40:05 by Michael Mifsud

We have updated the new DkWiki V2.1 to use the V3 of the DomTemplate:: and created a project page where you can download the code from, have a look you can use it however you want, pull it apart, or use pieces for your own project.

It is built on a framework we developed and has served us well for the last 10 years, we are now moving onto a new in-house framework and this one is being release into the public domain for you to use as you wish. We will continue to add minor updates here. Those updates will only be security fixes nothing major.

And you can get the DkWiki HERE!

Some Design Tips From My Experience

Posted on 2012-08-13 14:54:25 by Michael Mifsud

Over my time in developing and designing websites i have followed a number of rules that help me save time and give me good results. These ensure that your design will look more professional and allow others to extend your design when changes are required.

Here I will list a number of do's and dont's that I tend to stick by to ensure a good design.

    This one get me going every time I see it, it is bad design hard to maintain and look terrible. I can see a table layout from a mile away, it went out in the 90's so do not do it is the rule.
  2. Avoid HTML WYSIWYG editors...
    I say this because they generally add in-line attributes and styles that will stuff you up, then you will break more rules to try and make the site look good in the viewer instead of using your brain to get it working correctly. It makes you lazy and not think things through. If you do want to use these editors, you MUST go over the final code/markup and get rid of elements that will stuff up the main page design. Use a split view so you can see the code that is being created and clean it up as you go. These editors are suppose to save time but from experience all they to is create work. In the end you have to clean all the code they produce anyway so you might as well write the code yourself from the start.
  3. Do Not Use In-line Styles or Style Blocks In the Body Tag.
    This is another one that will stuff up perfectly good stylesheet/design. Once you override the sites base style-sheet rules the site starts to look tatty once you change a few styles in the style-sheet. This follows on from rule #2 some editors will add stuff like font types and colours and the like stuffing up the site style-sheet rules. Remove them and if you want a different colour, do it in the style-sheet.
  4. Do Not Size Images Using attributes (Width/Height)
    In this new world where we are implementing responsive design, image attributes like height and width can be a reall pain in the ass, insert images and re-size them using the style-sheet and not the attributes.
  5. Attributes Like Align="center"
    To center a block use the margin 0px auto: method. using align="center" is no longer valid HTML on any level. DO NOT USE IT! Its a pain to work with once its in place.
  6. Clean HTML Indentation
    Keep your code clean, even if you have to do it manually, use spaces as tabs and have 2 spaces per tab. The cleaner your HTML CSS and javascript is the easier it is to come back to later and modify. Again some editors will stuff this right up for you. Netbeans has a clean IDE that does good at formatting XML and HTML and its FREE!
  7. Spaces In Filenames especially images
    Again just do not do it. I see it all the time, sites broken because they added a space in a file-name, you may get away with it 80% of the time but trust me it will come back to bite you when you want to add stuff to the site. I have seen it chew up a days development trying to find the problem when all it was, was a space, use an underscore if you have to or camel case (part1_part2.png or part1Part2.png) and you will never get bitten.
  8. Use The <br/> Tag Rarely.
    One of my pet peeves is seeing someone add three <br/> tags just to add space below text. Its bad practice and again will cause yo to stuff up your style-sheet design, some editors use the <br/> tag everywhere to screw with you.
    It should only be used to break words into a new line where you want to force a new line. If you want to add space below a sentence/paragraph use an empty p tag like so <p>&nbsp;</p> this will give you a more structured looking page and work within your styles. If the space is to big or small, add a class to it and make it the height you need or use 2 of them. Simple elegant and proven to work.
  9. Use Tags Appropriately Where Possible
    What I mean is do not use a <font> tag (EVER! Is't no longer valid HTML anyway) or <span> tag in place of the proper value. For example <span style="font-weight: bold"> is bad practice, unless you have a valid reason, you should be using <strong> highlight bold text. There are numerous tutorials on the topic check them out. Again this can be the resulting markup from some poorly design editors.
  10. Always practice XHTML markup even for HTML5
    When coding it is always good (for DOM essential) to ensure your document validates against the XHTML ruleset. That means always closing tags, for example <br> is bad <br/> is good no <img src=""> this should always be <img src="" />. Find out the rules and use them they ensure the longlevity of your markup. Also check your document for unclosed tags or missing </div> tags as this can cause all sorts of confusion with javascript and browser rendering. Use a tool called `xmllint` if using linux as it is invaluble or alternativly find one of your own that checks your markup.
    When you use the DOMTemplate:: you will have to have XHTML valid markup for the system to read the source templates or else you will get an error. This has been done to ensure quality templates and proper markup within projects.

Finally I recommend signing up to some RSS feeds to see what the web community is doing, set aside the first hour of every day to read the articles and see if there is anything that you can learn/pracise from their content.

Here is a short list of good feeds to get you started. Every time you find a site that publishes good tutorials or articles add it to you own list:


Version 3.4 Released

Posted on 2012-08-08 09:39:44 by Michael Mifsud

Another fast release but I have added a new tutorial to the docs and wanted the version to match the new tutorial.

Happy templating...


  • Added the ability to add header tags to sub template without a body tag to allow designers to add header tags to the final rendered page.
  • Cleaned up HTML formatting so the output conforms more to strict XHTML
  • Added prepend.... methods to allow the prepend of templates, documents and html etc.
  • Fixed header tag rendering so each tag is on a new line.

Ver 3.3 Released

Posted on 2012-08-02 06:05:50 by Michael Mifsud

Its a quick turnover in releases this week, I have been experimenting with a new object Dom_ObjectRenderer and I wanted to add it to the release as soon as I could to see what others think.

This object Renderer class gives the Dom_Template system an interface like the smarty template system and others where you send the renderer the objects and values and the renderer, renderers those objects and values based on instructions from the raw template.

I have added a writeup in the wiki and there is an example in the V3.3 package. I have also got the other examples working with the V3 Dom_Template system.


DOMTemplate:: Update 3.2

Posted on 2012-08-01 06:10:51 by Admin

This release has a few updates, nothing major:

 - Trying  out a slightly new way to load the template file.
    Now if a file is submitted with the XML start string <?xml... the file
    is loaded and saved as an XML file. Otherwise it will be assumed to be a HTML file.
 - minor code cleanup

Mostly this release has to do with the static load() and loadFile() methods.

Basic V3.0 Documentation Updated

Posted on 2012-07-12 08:38:39 by Michael Mifsud

We have updated the basic tutorial documentation for the DomTemplate::.

We hope to update the API docs soon.

Update Released: V3.1

Posted on 2012-06-29 11:02:14 by Michael Mifsud

We have released a new update to the V3 Dom_Template as we found a number of major issues with the new updates and the repeat system.

With this release we have completely re-written the repeat system so that is is more optimised and also has cleaner more readable code.

We have deprecated the Dom_Repeat::append() method in favor of the Dom_Repeat::appendRepeat(). The old method remains for now but will be removed in later versions so start updating your code.

We are currently reviewing code documentation systems and will update the project docs as soon as we can.

DomTemplate V3.0 RELEASED

Posted on 2012-06-15 11:51:24 by MIchael Mifsud

the new V3.0 Dom_Template lib.
Whats New?

- Renamed functions so append, insert and replace, mean append/insert/replace...
- DOMNode objects/array can now be sent to functions as an alternative to a var name string allowing for operations to be performed on a wider range of document nodes, these nodes must be within the current document.
- Renamed factory static functions to load() and loadFile()
- If a template is generated from a file the DOMDocument::documentURI value is updated to the path of the file.
- Updated to handle HTML5 documents, however the XHTML standard must still be followed.
- Added new static $capture array to allow for alternate notes to be stored for later retrieval, eg if wanting to add new tags to document for development purposes.
- Removed preInit() function in favour of the new $capture array, as same results can be achieved.
- Removed replaceText() (because the node was not being replaced) and added insertText() and appendText()
- Added addClass() and removeClass() to make class modifications easy.
- Added innerHtml() to retrieve the content of a node.
- when using the var="" attribute multiple vars can now be mixed for example var="name companyUrl" is now valid and more can be strung together.
- Errors are now more verbose and you now get the line and column of the offending characters in your template, lessening the need for external tools like xmllint.

Take note we still have not updated the site documentation and it remains there for the Version 2.0  lib. We hope to fix this in the near future.

New DOM::Template Site

Posted on 2011-07-10 14:03:05 by Mick

It' 2011 and we are back with a new site. The DOM:Template Libs have been updated with some extra features.

Some of the new Features include:

  • Updated insertHtml() calls to insert html into a node an not replace the node
  • Added replaceHtml() calls to replace a DOM node contents
  • Adde appendHtml() calls to append html to a var node
  • Added insertTemplate(), replaceTemplate() and appentTemplate() calls
  • Moved all DOM classes to one Template.php file
  • Added translation of HTML entities so &nbsp; and more will work seemlessly
  • Added static loadXML() and load() calls to create a new template from a string or file
  • Template headers are now copied when using insertTemplate() and replaceTemplate()
  • Added addClass() and removeClass() calls to make it easy to manage css class names in nodes
  • Added appendCssUrl() and appendCss() to allow easy addition of CSS files and strings
  • Added appendJsUrl() and appendJs() to allow easy addition of JavaScript files and strings
  • Added new static insertHtmlDom(), replaceHtmlDom() and appendHtmlDom() as usilities to add HTML to any DOMElement object
  • Added insertDoc(), replaceDoc() and appendDoc() calls to insert a DOMDocument into a node
  • toString() now parses the template and returns the resulting html/xml

Keep checking back from time to time or signup to the RSS feed to find out about our new tutorials as they come online.