Jump to content

<p>Code layout and coding conventions</p>


Nabeel
  • Code Format

    phpVMS is written in the MVC format on a custom framework called "Codon". This format allows easy customization, while separating all of the application logic from the HTML views. Some basics:

    • Controllers are the "heart" of the application - located in /core/modules
    • Views are the HTML output and templates - located in /core/templates
    • Models are the data-base layer - located in /core/common

    For a great explanation of the MVC format, read: http://net.tutsplus.com/tutorials/other/mvc-for-noobs/

    Coding Conventions

    To make everyone's life easier, please adhere to these conventions:

    1. camelCase on data functions
    2. Modules/folders should all be in lowercase (I know the default doesn't adhere to this, but new modules will)
    3. Brackets on the next line, and a tab (or 4 spaces) to indent. These are all wrong:

    function something(){
    echo 'dont code like this';
    }
    
    // or
    
    if($something==$somethingelse){
    echo 'hey';
    }
    
    //or
    
    if($something == $somethingelse)
    { echo "hey"; }
    

    This is right:

    if($something == $somethingelse)
    {
    echo 'see this looks cleaner';
    
    if(1 == 1)
    {
    echo 'another tab';
    }
    }
    

    Naming Templates

    Name templates with the modulename first in lowercase, an underscore, then a descriptive name (mymodule_viewallthings.tpl)

Code layout and coding conventions


User Feedback

Recommended Comments

There are no comments to display.



Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Add a comment...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...

×
×
  • Create New...