Creating a custom tag library

Nest tag libraries are just classes that extend the tag library class and map tag classnames to simple names. Generally the tag implementations themselves are stored in the same file to simplify file including.

Let's start by creating a simple tag library that we will add to through the next steps.

SimpleTaglib.php
<php
require_once 'HTML/Template/Nest/Taglib.php';

class SimpleTaglib extends HTML_Template_Nest_Taglib
{
    protected $tags = array(
        "simpleTagFile" => "SimpleTaglib_SimpleTagFile", 
        "simpleTag" => "SimpleTaglib_SimpleTag",
    );
}

The key in the $tags array is how the tag will be referenced in the nest template, and the value is the actual classname.