Adding the Categories functionality into Interspire Website Publisher was quite easy, this is how I did it.

The first thing I did was to create the class that interfaces between the user and Interspire Website Publisher. This class extends upon the API that already has most of the functionality I need (such as loading specific categories or saving them). This provides me with a quick way of getting things going. So, I call it iwp_admin_categories and save it as /admin/includes/classes/class.categories.php.

class iwp_admin_categories extends iwp_categories {
	private $Instance;
	// etc...
}

With this newly created class I can now begin adding functions as needed. For viewing the categories list, I add a function named View and give it no parameters. This is picked up automatically by Interspire Website Publisher, when the action in the URL is view. What I mean specifically, is the URL structure is dynamic, meaning you can add functions and then use those within the URL. Adding a function named View() will allow an action of view to be used.

public function View() {
	echo "Within the View() function.";
}

Within my View function now, I need to designate the template file to be displayed, and set any content that needs to be displayed within it (such as the categories list). The template file will handle the loading and displaying of the categories, interfacing back into this categories object. We've designed the template engine to handle almost any use-case, the categories page is a special instance that we've had to accommodate for specifically. With the use of a foreach loop, and the wonders of recursion, we have a quick and easy way of building the category tree.

{foreach from=%admin_categories.GetCategoryList:'0' key=k item=row id=ViewListLoop}
	// Formatting the output of each category here
		// Recurse into any children
		{recursion=$row.categoryid}
{/foreach}

Regarding the template code specifically, we will be releasing in-depth documentation for it with the release of Interspire Website Publisher and also within further posts in the near future.

All in all, this presents us with a category list that works wonders.

Questions? Comments? I'd love to hear them, just post below and I'll be sure to read and respond.