MySQL
  Home arrow MySQL arrow Page 6 - Building a Simple ColdFusion Content M...
Dev Shed Forums 
Administration  
AJAX  
Apache  
BrainDump  
DHTML  
Flash  
Java  
JavaScript  
Multimedia  
MySQL  
Oracle  
Perl  
PHP  
Practices  
Python  
Reviews  
Security  
Style-Sheets  
Web Services  
XML  
Zend  
Zope  
Forums Sitemap 
IBM® developerWorks 
Sun Developer Network 
E-Commerce Hosting 
Linux Web Hosting 
Managed Hosting 
Small Business Hosting 
Mobile Linux 
App Generation ROI 
VPS Hosting 
Weekly Newsletter

 
Developer Updates  
Free Website Content 
 RSS  Articles
 RSS  Forums
 RSS  All Feeds
Write For Us Get Paid 
Request Media Kit
Contact Us 
Site Map 
Privacy Policy 
Support 
 USERNAME
 
 PASSWORD
 
 
  >>> SIGN UP!  
  Lost Password? 
MYSQL

Building a Simple ColdFusion Content Management System with MySQL
By: Charles Kaufmann
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: 4 stars4 stars4 stars4 stars4 stars / 46
    2004-08-11

    Table of Contents:
  • Building a Simple ColdFusion Content Management System with MySQL
  • Starting With MySQL
  • The Page and how to Update/Modify and Delete
  • Add/Modify Form
  • Action
  • Breadcrumb List
  • Side Menu
  • Site Map

  • Rate this Article: Poor Best 
      ADD THIS ARTICLE TO:
      Del.ici.ous Digg
      Blink Simpy
      Google Spurl
      Y! MyWeb Furl
    Email Me Similar Content When Posted
    Add Developer Shed Article Feed To Your Site
    Email Article To Friend
    Print Version Of Article
    PDF Version Of Article
     
     
    ADVERTISEMENT


    Building a Simple ColdFusion Content Management System with MySQL - Breadcrumb List


    (Page 6 of 8 )

    Breadcrumb lists are useful for many people that may be navigating your site. As they click deeper in your site, they often would like to go back up the hierarchy of it or simply go back to the home page. We are going to create a new page (you can call it whatever you want but for this tutorial I will name if Breadcrumb.cfm) for the breadcrumb code, then CFINCLUDE it into the top of the page after the CFQUERY for the page. So on a new ColdFusion template add the following.

    1   <!--- Bread Crumb --->
    2   <cfset breadcrumblist = "">
    3   <cfloop list="#getpage.hierarchy#" delimiters="~" index="i">
    4     <cfquery name="breadcrumb2" datasource="#variables.data#">
    5       select *
    6       From tblpages
    7       Where id = #i# and status='A'
    8    </cfquery>
    9    <cfset breadcrumblist = #breadcrumblist# &
    10  ' &gt; <a href="page.cfm?id=#breadcrumb2.id#" target="_self">
    11  #breadcrumb2.title#</a>'>
    12  </cfloop>
    13
    14  <cfif listlen(breadcrumb.hierarchy, "~") gt 1>
    15   <cfset baseid = #listgetat(breadcrumb.hierarchy, 2, "~")#>
    16  <cfelse>
    17   <cfset baseid = 1>
    18  </cfif>
    19  
    20  <cfoutput>#variables.breadcrumblist#</cfoutput>
    21  <!--- Bread Crumb --->

    Now let's walk through it. Line 2 sets a variable that will contain the list. Line 3 starts the CFLOOP that will loop through the HIERARCHY field that we have built on the record add action previously discussed. Since we already ran the CFQUERY for the current page, we can use the results in the CFLOOP. We are going to loop through the hierarchy list to query out the title of all the pages that will be shown on the breadcrumb list. Lines 4 through 8 query the records every time through the loop using the value in the hierarchy list to query out the ID of the record. Lines 9 through 11 add to the breadcrumb list variable with all the HTML markup so people can click on the link to bring them to the page.

    Lines 14 through 18 set a variable called "Baseid". This variable will be used for the menu that will be explained in the next section. The menus I will be building next will be based on the HIERARCHY field. The menu may get rather long if it displays all of the pages within the site (if the site you are building is going to get large). What I am trying to accomplish with the Baseid variable is to determine what section of the site you are at. I am trying to get the ID of the second level page, which would be pages that are the children of the home page. Line 14 starts a CFIF statement that checks to see if the hierarchy list is greater than 1 (not the home page). If the CFIF is true, then it CFSET's the baseid variable to the second number in the hierarchy list. Line 16 and 17 catch the false value and CFSETS the baseid to 1 because it is the homepage. Line 20 simply outputs the breadcrumb list on the page.

    More MySQL Articles
    More By Charles Kaufmann


       · Very good explanation on building table in mySQL, I could do with more help building...
       · The code is very unclear. The author jumps from one page to another without any...
       · I disagree with the previous poster. Yes, you must be familiar with cfoldfusion to...
     

       

    MYSQL ARTICLES

    - MySQL Server Tuning Tips and Tricks
    - MySQL Query Optimizations and Schema Design
    - MySQL Benchmarking Tools and Utilities
    - MySQL Benchmarking Concepts and Strategies
    - Take Some Load off MySQL with MemCached
    - MySQL Table Prefix Changer Tool in PHP
    - Using the SIGNAL Statement for Error Handling
    - Error Handling Examples
    - Error Handling
    - Completing a Search Engine with MySQL and PH...
    - Paginating Result Sets for a Search Engine B...
    - Building a Search Engine with MySQL and PHP 5
    - Using Boolean Operators for Full Text and Bo...
    - PHP, MySQL and the PEAR Database
    - Working with PHP and MySQL





    © 2003-2008 by Developer Shed. All rights reserved. DS Cluster 2 hosted by Hostway
    Stay green...Green IT