toaH Update

So after quite a long time a very big update for a project that small. In this post I will give a detailed view at the changes, as the changelog doesn’t fit for this purpose.


All the time since the update to version 2 toaH had a big attachment called Simple HTML DOM. The problem was that Simple HTML DOM was much larger than toaH itself.

I now managed to switch to DOMDocument and DomXPath provided by the PHP core. They are therefore available on every system with PHP5 installed.


As a result of the change in the back-end, toaH becomes up to twice as fast as previous versions of toaH version 2. This is also achieved by reusing the return values of DOM functions and thus needing less search operations.

data storage

Storing everything in a big global array was kind of ugly. It is now replaced by a static class, which also contains a set of functions used across toaH.


Adding modules was also enhanced. In the static class T there are 2 functions to add a module.

  • registerModule($stage, $function) allows to make a function be called either at the very beginning ($stage = 0) or after the template and the files (menu.txt, style.css and custom ones (see next point)) were loaded ($stage = 1)
  • registerFile($name, $function, $multiple=true) allows to add a file to the file search (toaH searches for specific files (menu.txt, style.css) in parent directories). $name is the name of the file (e.g. footer.txt). $multiple tells whether the search should be stopped after the first file was found. If a file is found $function is called with the absolute path and the filename as well as the path starting from the webroot and the filename as parameters.

Some information on how $function should look like is given here:

Comments are closed.