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 Reviews  
Web Hosting Security  
Weekly Newsletter 
Developer Updates  
Free Website Content 
 RSS  Articles
 RSS  Forums
 RSS  All Feeds
Write For Us 
Contact Us 
Site Map 
Privacy Policy 
  >>> SIGN UP!  
  Lost Password? 

Building a CMS
By: Chris Root
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: 4 stars4 stars4 stars4 stars4 stars / 22

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

  • Rate this Article: Poor Best 
      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




    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

    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


    - Phishing Scams: An Overview and How to Detec...
    - Tips for Safe Downloading Online
    - How To Avoid Spam
    - How to Get Into Ethical Hacking
    - How to Prevent Drive-by Downloads
    - Facebook Timeline Tips and Tricks
    - How to Keep Up with Facebook`s Changes
    - Wi-Fi Network Security Tips
    - Tips for Safe Online Holiday Shopping
    - Facebook Privacy: Keeping Up with the Const...
    - Tips for Facebook Privacy
    - How to Cover Your Tracks on the Web
    - SSH Keys for FileZilla and Putty in Cpanel
    - How to Create a Filezilla FTP User
    - How to Install FileZilla Server

    Developer Shed Affiliates


    © 2003-2019 by Developer Shed. All rights reserved. DS Cluster - Follow our Sitemap