At the moment my favorite tool for custom tailored web sites is ProcessWire.

If you never heard about it before, it is a very clever piece of PHP-based Content Management System/Framework with a very powerful but intuitive API which plays very nicely along with other applications. I have build (or was involved in) projects based on ProcessWire from small personal to large corporate and e-commerce sites, over the last two years and it has turned out to be a really great and flexible tool.

Here is a little snippet I just submitted to since I use this on nearly every site to have the html page <title> Tag reflecting the rootline (the line of ancestor pages up to the root or home page)

function renderPageTitle($options=array()){
	$defaults = array(
		'glue'    => ' « ', // ' » '
		'reverse' => true   // false
	$opts = array_merge($defaults,$options);
	$page = wire('page');
	$parents = $page->parents;
	$items = array();
	foreach($parents as $parent) {
		$items[] = $parent->title;
	$items[] = $page->title;
		$items = array_reverse($items);
	$out = implode($opts['glue'],$items);
	return $out;

In the template you can then use it like this:

 $htmTitle = renderPageTitle();
 <title>< ?php echo $htmlTitle; ?></title>

There are two options you can set by giving an array as the only parameter to the function; "reverse" can either be true or false, and triggers if the current page is at the start or at the end of the rootline, "glue" is a string that will be used as a separator between the page titles.

Say you have this tree structure:

- Home
- - Articles
- - - Article A

The by default the returned string for the title tag would look like this: Article A « Articles « Home.

If you want to reverse the order,


will result in this: Home « Articles « Article A.

Since now the "glue"'s arrow is the wrong way,

renderPageTitle(array('reverse'=>false,'glue'=>' » '));

will change it to: Home » Articles » Article A.

Of course you can use any character or combination of characters you like:

renderPageTitle(array('glue'=>' ::: '));

results in: Article A ::: Articles ::: Home