Web Hosting How-Tos
  Home arrow Web Hosting How-Tos arrow Page 4 - Building a CMS
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
By: Chris Root
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: 4 stars4 stars4 stars4 stars4 stars / 12
    2005-01-05

    Table of Contents:
  • Building a CMS
  • An Outline
  • The Application
  • Object Oriented Code
  • Constructing the Main Heading Markup

  • 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 - Object Oriented Code


    (Page 4 of 5 )

    Each document feature is going to need its own unique markup, so let's write a Javascipt object for each feature that will contain what we need for that feature, along with a method that will validate the form entry, and assemble the markup from the information gathered from the form.

    First, a little background on Javascript objects for those of you who have never coded one. Javascript has some object oriented features which can, just as in any other language that has them, be used to make code more portable and modular. In the near future Javascript is expected to go fully object oriented, complete with class structure, inheritance and strong typing. Until then we have what are called object constructors that look like functions but are used as objects in our code.

    These objects can have properties which are set when creating an instance of the object or left in their initialized state until they are set later. They also have public methods which are defined outside of the code block that defines the object but are declared as methods of the object by using the keyword "this."

    function myObject(myProperty)
    {
       //property set via the argument sent to the object
       this.objectProperty = myProperty;
       this.initializedProperty = false;
       //establish myMethod as a method of this object
       this.myMethod = myMethod;
    }
    function myMethod()//method
    {
       if(this.myProperty > 0)
       {
          this.initializedProperty = true;
       }
    }

    Once you have this code, all you need to do to use it is to create an instance of it. As in many programming languages that have object orientation you use the keyword "new."

    //create an instance
    var newObj = new myObject(2);
    //invoke the instance's myMethod method
    newObj.myMethod();
    alert(newObj.initializedProperty);

    If you executed this code, you would get an alert box that would display the word "true."

    More Web Hosting How-Tos Articles
    More By Chris Root


       · Welcome everyone. Any comments you have on the story, let em' fly!
     

    WEB HOSTING HOW-TOS ARTICLES

    - 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
    - How to Pick Domain Names






    © 2003-2009 by Developer Shed. All rights reserved. DS Cluster 1 Hosted by Hostway
    Stay green...Green IT