Logo hugi.to  
Projects >> Site Concept

How this site works

When I started designing my homepage I tried to emphasise on three major things:

  • easy mainenance
  • flexible and scalable
  • multilanguage support

To achive those three basic requirements I parted structure, design and content.
The structure is made with XHTML and the design was implemented with CSS, that was the easy part.
To deside on the technology to provide the content was a bit harder. Obviously I could save the content in XML documents or safe the content to a database. Especially regarding scalability the database solution had benefits over the xml solution, however this is just a private Website so I desided to go for the xml document solution. Easier editing of the content (I didn't need to write a database interface for editing) and the presence of a physical file structure on the webserver (again, this could be a downside on larger projects of course).

So I ended up with XHTML, CSS and XML. PHP should be used to glue everything, getting my Website finally. These tools are used to build the site:

  • Smarty (a very fast template-engine)
  • Menu3 - a class providing several navigation structures based on folders
  • a simpel XML parser
  • a page-model

The PHP file, which finally is called by the user, only instantiates a new page-model object and, if needed, sets new values for SKins, languages, templates etc. (in case default values are not appropriate).


<?php
// include the page class
include_once('page.class.php');

// instantiate the class
$p = new page;

// output the built xhtml page
$p->printContent();
?>
    

Obviously the works doesn't happen in the file called by the client, but in the page-class. The page-class starts and/or manages the session, reads the Clients prefered language, gets the content out of the XML file and assignes it to Smarty, builds the menu structure with the help of the Menu3 class and again assigns everything to Smarty and many things more...

The site-model manages dynamic content, too. I therefore defined an XML Tag which interrupts the page building and calls the plugged in class that returns the already fully formated XHTML. Examples are the GeekBox and the listing of the most recent weblog entries as well as the contact form.

The site-model is very poorly documented at the moment with rather messy written code. This means that this website is actually still in beta. ;-)
As soon as everything works as it should and the class is more readable, I will provide some more code examples here and put the class on the site for free download.



Last Update: 2007-12-28 | © Reto Hugi http://hugi.to/projects/site/index.php <<^^>>

Powered by PHP Valid CSS! Valid XHTML 1.0!