Developers Standards

From Zen Cart(tm) Wiki
Revision as of 02:24, 1 January 2006 by Wilt (talk | contribs) (PHP Code Tags)
Jump to: navigation, search

Zen Cart Coding Standards Currently I am using a mix of the pear/phpBB coding standards docs to provide the categories as below.

BTW, the coding standards posted here are what we strive for. They are not a definition of how code is currently written. So if the code you get, does not match posted standards, don;t be suprised. Its a long and ardous battle to convert all core code.


Currently, the standard is not to use hard tabs, and to use 2 spaces per indent.

My thoughts are this, regardless of whether you use tabs or spaces for indents, anything more than 2 spaces can quickly lead to indent hell. the argument then becomes whether indents should be hard tabs or soft spaces.

I have to say I prefer soft spaces. Unless someone can come up with a convincing argument otherwise,(this is mainly because the tab /t can be interpreted differently across OS's and editors, whereas a space is always interpreted the same whatever.

Control Structures

Function Calls

Function Definitions


Including Code

PHP Code Tags

This is fairly simple, nver use short open tags <? or asp tags <%

Always use th full <?php ?> tags

Header Comment Blocks

Example URLs

Naming Conventions

Variable Names

Function Names

Class Names

Code Optimisations

SQL/SQL Layout

File Locations