Skip to content
Aug 19 / kkrizka

HTML Document v0.1 – Creating Complex HTML Pages Fast

A new and unique class was just released by me! It is called HTML Document, and I have been using it for the past few years as the core of all my web pages. This means that over the time it has been honed, and all cleaned of almost all bugs. I’ve decided to finally release it because I think that many other web developers will be able to use its power to create complex dynamic pages without needing complex code.

There are several reasons why I created this class. First of all, it saves me a lot of typing. Now every time I start a new page, I do no have to manually add the HTML, HEAD, and BODY tags, because the class does it all for me. Also adding CSS stylesheets is just a matter of one line, and it can be done from anywhere in the document, but just right before the start of the BODY tag.

The jewel of this class is output buffering. All output is buffered until the end of the script, and then it is send to the browser. This allows for a greater flexibility when developing pages, and makes the code much cleaner. For example, I no longer have to make sure that all HTTP headers are sent before any output. This means that I can display the menu that is the same in the entire website, then include another file that takes care of logging in a user, and redirecting him to his profile upon success. Also I can include one page within another, or just display the second page on its own, without destroying the XHTML structure of the document. I can have a login page included in the index.php file along with the global menu, or I can display it on it’s own.

Visit it’s own page for more details, documentation and the source code!

I have not heard of another class that does the same thing, but that does not mean that there isn’t an duplicate. So if you know of a similar class, why not contact me? I would be interested in comparing my own PHP class with it.

Leave a comment