Web Hosting How-Tos
  Home arrow Web Hosting How-Tos arrow Building a CMS, part 2: Taking it to t...
Web Hosting Articles  
Web Hosting FAQs  
Web Hosting How-Tos  
Web Hosting News  
Web Hosting Security  
IBM® developerWorks 
Sun Developer Network 
Weekly Newsletter 
 
Developer Updates  
Free Website Content 
ASP Web Hosting  
ASP.NET Web Hosting 
Budget Hosting 
Coldfusion 
Colocation 
Mobile Linux 
APP Generation ROI 
E-Commerce Hosting 
Linux Web Hosting 
Managed Hosting 
Reseller Web Hosting 
Shared Hosting 
Small Business Hosting 
Virtual Private Servers 
Windows Web Hosting
 
 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? 
WEB HOSTING HOW-TOS

Building a CMS, part 2: Taking it to the server
By: Chris Root
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: 4 stars4 stars4 stars4 stars4 stars / 1
    2005-03-30

    Table of Contents:
  • Building a CMS, part 2: Taking it to the server
  • Generating the XML
  • Creating the Markup
  • A Word About Namespaces
  • PHP XSLT

  • 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 CMS, part 2: Taking it to the server


    (Page 1 of 5 )

    In the first article on this topic, Chris Root discussed the procedure for constructing a simple HTML form-based application to publish a company press release. In this article, he explains how to convert the form output to XML, and how to convert the document to other formats as needed.

    Content management systems (CMS) are a growing software category these days. Sites small and large are using various combinations of commercially available, open source and custom built solutions to manage ever growing content needs for all types of information. Many times a custom built solution is needed, especially when non-technical users are expected to contribute content.

    In my last CMS article I went through the procedure for constructing a simple HTML form-based application to publish a company press release. In this article we will modify and expand the application to include operations on a PHP/Apache back end.

    Specifically, we will be converting our form input, not to HTML but to XML, and using XSL transformations to convert our document to HTML and other formats as needed. Having something such as a press release available in multiple formats would be essential, and having the data stored in a presentation neutral format such as XML is ideal, so let's get started.

    Recap

    For a brief recap, we have a form-based application that collects data from the user about the press release main heading, date and time, content sub-heading, release content, company description heading (About Company X) and description text, as well as PR contact information and company website address.

    Previously we used Javascript form processing to generate the HTML for a press release page in a new browser window, which could then be saved and emailed to an admin or deposited in a drop box directory for posting on a company website.

    This time we will throw out some javascript code and add some other code specifically for the purpose of sending our data to the server for storage in an XML file.

    Aside from any validation code that may be used, and a function to provide the current date and time, the only Javascript requirement we have is to keep the code we need to compile multiple company descriptions. It was a requirement in our previous version that if Company X was working with Company B on something that was the subject of our press release, we would want to put more than one "About This Company" section in the document. Any HTML generation code is no longer needed.

    The form looks like this.



    For company descriptions we have a custom Javascript description object that holds all the information that is needed for each company description and has methods that allow the user to add, delete and modify descriptions before saving the data to the server.

    var descriptionObj = null;
    function description(head,text)
    {
       this.descHead = "About Company X";
       this.descText = "Company X is a multinational manufacturer" +
        "of widgets for everyday life. Company X spatula division " +
        "ships spatulas to over 60 countries, a list that is expanding" +
        "on a regular basis. Based in Orlando Florida, with offices in " +
        "20 states and affiliates and partners throughout the world blah blah blah.";
       this.desc_Arr = new Array();
       this.head_Arr = new Array();
       this.head_Arr[0] = head;
       this.desc_Arr[0] = text;
       this.addC = addC;
       this.deleteC = deleteC;
       this.restoreDefault = restoreDefault;
    }

    The description object properties descHead and descText are the defaults. There are two arrays that hold multiple headings and description text entries and methods for adding, deleting and restoring the defaults.

    The addC method below will add a description.

    function addC(sel,head,text)
    {
       if(head.value != "" && text.value != "")
       {
          var optobj = document.createElement("option");
          optobj.value = sel.options.length;
          optobj.text = head.value;
          sel.appendChild(optobj);
          sel.selectedIndex = sel.options.length - 1;
          var hIndx = this.head_Arr.length;
          var tIndx = this.desc_Arr.length;
          this.head_Arr[hIndx] = head.value;
          this.desc_Arr[tIndx] = text.value;
       }
       else
       {
          alert("Please Enter Both a Heading and Text description");
       }
    }

    There is a select menu which displays all company descriptions to the user and allows them to view each one. This method creates a new option for the select menu and adds the new data to the description object. If one of the fields is not filled out it prompts the user to do so. The deleteC method simply reverses this.

    More Web Hosting How-Tos Articles
    More By Chris Root


     

    WEB HOSTING HOW-TOS ARTICLES

    - Choosing a Web Host for Your WordPress Blog
    - Connecting to a Server using SSH: the Fundam...
    - How to Expand a Simple Website
    - Practical Virtualization with VirtualBox
    - Other Uses for Your Web Hosting Server
    - Hosting Your Own Website: Reliability
    - Introduction to Hosting Websites
    - Choosing a Website Host
    - How to Choose a Budget Web Host
    - URL Redirection
    - How to Link a Domain Name to a Dynamic IP
    - How to Set up a Simple Website
    - Choosing the Right Kind of Web Hosting
    - Introduction to Choosing the Right Web Host
    - Strategies for Creating Domain Names






    © 2003-2009 by Developer Shed. All rights reserved. DS Cluster 6 Hosted by Hostway
    For more Enterprise Application Development news, visit eWeek