noloh Logo SmallDeveloper Zone
Username:
Password:
remember meforgot password?Login
twitterfacebookirc
plusfolder closePrinciples
plusdocumentWhat is NOLOH?
plusdocumentWhat's so Bad About Markup?
plusdocumentDevelopment and Philosophy
plusfolder closeFeatures
plusdocumentSyntactical Sugars
plusdocumentMultiple Inheritance
plusdocumentBookmarks and NOLOH
plusdocumentUser State Management
plusdocumentSearch Engine Friendly
plusfolder closeGetting Started
plusdocumentPHP and NOLOH Syntax
plusdocumentHello World
plusdocumentConstructors
plusdocumentInstalling NOLOH
plusfolder closeCrash Course
plusdocumentNOLOH and CSS
plusdocumentLayout in NOLOH
plusdocumentDatabases
plusdocumentData::$Links
plusdocumentEvents in NOLOH
plusdocumentMoving and Resizing Your Objects
plusdocumentMultiple Inheritance
plusdocumentBookmarks and NOLOH
plusdocumentData Binding
plusfolder closeAdvanced Topics
plusdocumentCustom Events
plusdocumentClientside Functions
plusfolder closeSyntactic Sugars
plusdocumentSyntactical Sugars
plusdocumentCascading
plusfolder closeCoding Guidelines
plusdocumentBest Practices
plusdocumentNOLOH Naming Conventions
PHP and NOLOH Syntax
PHP and NOLOH Syntaxoverviewdiscussion

NOLOH is a completely object-oriented platform for PHP. As such, it's important to know basic PHP syntax and PHP OO syntax.

PHP is an untyped C-style language, so if you have any experience with other C-style languages, PHP syntax should be familiar to you. For more detailed information about PHP syntax, see http://us3.php.net/manual/en/langref.php

All php files begin and end with <?php, ?>

<?php
?>

PHP classes are structured in the following manner:

<?php
class ClassName
{
}
?>

For most classes to be useful they need functions, and members. A statement in PHP is ended with a semi-colon.

<?php
class ClassName
{
    //This is a public variable, accessible to all other objects through this object
    public $Variable1;
    //This is a private variable and is only accessible from within this class
    private $Variable2;
    //This is a protected variable, accessible to this class and classes that inherit from this class
    protected $Variable3;
    //This is the class constructor, which will automatically get called when an instance of this class is created.
    function ClassName()
    {
        System::Alert("test");
    }
}
?>

To make good use of NOLOH, you must know the basics of inheritance. Inheritance is the ability to have one class extend another class and consequently have access to its parent's functions and members, while also being able to override the inherited characteristics.

<?php
/*Here you can see that ChildLabel extends Label, thus it's a Label but it's
also able to implement its own unique functionality*/
class ChildLabel extends Label
{
    public $Creator;
    /*This variable will keep track of the Creator of this Label
    The following is the ChildLabel constructor and plays an important role in the object.
    The Constructor is a function that is called automatically when ChildLabel is created*/
    function ChildLabel($creator, $text)
    {
        /*In most cases, it's important to call your parent constructor. This allows the
        parent constructor to execute whatever code necessary for a Label. Unless you want
        to override all aspects of creation, it's best always to call your parent constructor */
        parent::Label($text);
        $this->Creator = $creator;
        //Sets the creator variable
    }
}
?>

Using Parameters and Calling a Function of an Object

<?php
class ChildLabel extends Label
{
    public $Creator;
    //This variable will keep track of the Creator of this Label
    function ChildLabel($creator, $text)
    {
        parent::Label($text);
        $this->Creator = $creator;
        //Sets your creator variable
    }
    function AlertCreator()
    {
        System::Alert($this->Creator);
    }
}
/*Creates a new ChildLabel, with the constructor parameters of "Asher" and "My label". These correspond to the $creator, and $text variables of the constructor*/
$label = new ChildLabel("Asher", "My label");
//Calling a function of ChildLabel
$label->AlertCreator();
//This above will call the AlertCreator function of ChildLabel, and Alert "Asher"
?>

These are the main things you need to know to get started using NOLOH. For more detail on NOLOH syntax, see Syntactic Sugars.

smallarrow
explanation arrowtool tip
handlebgexpand left
Right Up Outer CornerRight Down Outer CornerLeft Up Outer CornerLeft Down Outer Cornersearch-bottomclassconstantpropertymethodarticle
controltabsearchbig