Skip to content

Php internal guidelines

atomicflowtech edited this page Dec 19, 2011 · 2 revisions

When working with CodeIgniter, please go through the checklist below to determine re-use, readability and scalability of your code.

  • All Text displayed on a page should be defined in the language folder link
  • All PHP pages (e.g. Models, Controllers) Should Look like the following:
<?php 
    echo "Here's my code!";    
    /* End of file myfile.php */    
    /* Location: ./system/modules/mymodule/myfile.php */
  • Make sure to put informational comments on each function decleration link to CI
  • Typecasting comparison (=== instead of == and !== instead of !=) for comparing True/Flase, empty string, 0,1
  • SQL queries should be formated as followed for readability sake
$query = $this->db->query("SELECT foo, bar, baz, foofoo, foobar AS raboof, foobaz
			FROM exp_pre_email_addresses
			WHERE foo != 'oof'
			AND baz != 'zab'
			ORDER BY foobaz
			LIMIT 5, 100");

Clone this wiki locally