HomeMySQL Page 8 - Building a Simple ColdFusion Content Management System with MySQL
Site Map - MySQL
This tutorial lays out the basics for creating a content management system in ColdFusion and MySQL. The System leverages hierarchical data to automatically build breadcrumb lists, a side navigation menu, as well as a site map. The goal of this tutorial is to provide a framework upon which to build a content management system that is easy to customize and maintain, leaving the web author more time to create content than maintain code.
Site maps are useful to show people your entire site at a glance so they can more easily find what they are looking for. Another added bonus of a site map is it helps search engines spider your site. Here is the code.
Start by creating a new page called Sitemap.cfm or whatever you want to call it. Place the above code on it. What this will give you is your entire web site laid out in a hierarchical format with the last date the page was updated. Lets walk through the code quickly. Most of it should look familiar, because it is a very stripped down version of the side menu. This one includes all of the parents and children. The query is performed on all the active records and CFOUTPUT on line 7. I am using the same CFLOOP to put the dashes before the links. Lines 11 through 13 put the page links and the revision date on the page. That is it. Very simple because you have already done all the work on the add a new page action (populated the hierarchy variable).
We have walked through the creation of a simple but powerful content management system. We have leveraged the power of building the pages with a hierarchical structure which allows us to dynamically build out a breadcrumb list, a side menu and also a site map page. This was done to minimize the amount of time it takes to maintain and update a web site. This was not meant to be an extensive build out of a content management system, but to provide you with the core of what is needed. In order to put this on a public server, you still have to provide a way to authenticate the administrator so that you can lock all of the administrative functions from the public.