SunQuest
 
       MySQL
  Home arrow MySQL arrow Page 3 - 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 
Dedicated Servers 
E-Commerce Hosting 
Linux Web Hosting 
Managed Hosting 
Small Business Hosting 
Actuate Whitepapers 
VeriSign Whitepapers 
VPS Hosting 
Weekly Newsletter

 
Developer Updates  
Free Website Content 
IBM developerWorks
 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 / 45
    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

    Stay one step ahead of the competition. Evaluate and give feedback on some of the hottest web development tools on the market today. Make your opinion heard! Click Here

    Building a Simple ColdFusion Content Management System with MySQL - The Page and how to Update/Modify and Delete


    (Page 3 of 8 )

    We will now start writing some code to display a page and also to modify add and delete pages. I am going to write the code so that you can put it within the body tags and the entire piece is going to be located on the same page. Let's start out with the CFIF statement that is going to control the whole page. We are also going to set a variable that will specify your data source.

    <cfset data = "YourDataSource">
    <cfif isdefined("url.mod") or isdefined("url.add")>
    <cfelseif isdefined("form.modify")>
    <cfelseif isdefined("url.delete")>
    <cfelseif isdefined("form.add")>
    <cfelse>
    </cfif>

    So this is the flow of the program. If nothing is specified it is just going to load the page (the CFELSE). But if you are going to add, modify or delete, it will look at that specific area. The way we are going to create the hierarchy is that when you are adding a page, you have to select the add link from the page you want to create the child page off of. For example if you had a page on "building a bird house" and you wanted to create a child page off of it for materials, you would have to go to the "build a bird house" page then click on the add link. What this does is it provides the form with the ID of the parent page so that you can insert it into the PARENTID field.

    Show Page

    So let's build the CFELSE part (view the page). The first part will be the CFQUERY that will query out the record you are requesting (url.id). The below code is going to set a CFPARAM so that if the page is requested without a URL.ID it will load the home page.

     <cfparam name="url.id" default="1">
      
     <cfquery name="getpage" datasource="#variables.data#">
      Select *
      From tblpages
      where id = #url.id# and status = 'A'
     </cfquery>
     
     <cfoutput>  
       #getpage.body# 
     </cfoutput>

     <!---  Page/Site administration  ---> 
    <div align="center">
      <!--- put an if statement around this cfoutput to see if
       you are logged in. --->  
      <cfoutput>
       <a href="page.cfm?mod=#getpage.id#" target="_self">Modify</a> |   
       <a href="page.cfm?add=#getpage.id#" target="_self">Add</a> |    <a href="page.cfm?del=#getpage.id#" target="_self" onclick="return
        confirm('Do you really want to Delete this?')">Delete</a>
      </cfoutput> 
    </div>

    The only variable you are outputting is the BODY field from the query. This is a Text field that holds all the words and HTML that makes up your page. The next section is for page/site administration. There will be three links at the bottom of the page.

    The Modify link is to modify the existing page you are on.
    The Add page is to add a child page off of the current page.
    The Delete link is to delete the current 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 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
    - Getting PHP to Talk to MySQL
    - Creating an RSS Reader: the Reader
    - MySQL Security Overview
    - Creating the Admin Script for a PHP/MySQL Bl...
    - Creating the Blog Script for a PHP/MySQL Blo...





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