We forcefully moved to the new server and upgraded to Dragonfly CMS v10.
Please keep in mind we are working hard to get everything up and running, so please be patient.
Read/reply for issues in this forum topic /

Best regards, DJ Maze

Wiki ⇒ v9 Developer's Manual ⇒ Coding standards ⇒ CPG Dragonfly™ CMS
Wikiv9 Developer's Manual ⇒ Coding standards  

The Project
Upgrading or Switching
Dragonfly admininistration
Dragonfly public view
Dragonfly Themes
Build local server
Tips and Tricks
Rules & Regulations
v9 Developer's Manual
v10 Developer's manual
Wiki Permissions
13.2: Coding standards Parent

As you all know many people use their own standards when they develop code. Some use spaces others use tabs, some place many "1 liners" others strike it over several lines.
We will provide the rules including examples and why we do it.

Table of content

Spacing use tabs

We use tabs instead of spaces for a visual view of the 'depth' of the created code.
first level
second level {
3rd level {
The reason is simple. Some coders like a spacing of 2, others 4 and common is 8 spaces. By using tabs the designer can easily make the code viewable to his preferences since many editors have a 'tab spacing' option to set this up. A small nice benefit is that it makes the code smaller (8 spaces = 8 bytes, 1 tab = 1 byte)


We allow them in a few ways to easy-up the code in certain non-complex circumstances. For example "$a ? $a : $b" to replace "if ... else ...".
= isset($_POST['foo']) ? $_POST['foo'] : $_GET['foo'];


if (isset($_POST['foo'])) {
$c = $_POST['foo'];
} else {
$c = $_GET['foo'];

As you can see "} else {" is also a 1-liner since many people split this up on single lines as well.
We mostly use this one as well unless the code becomes hard to read and then we use the following (mostly in "do ... while" and "switch")

if (isset($_POST['foo']))
$c = $_POST['foo'];
$c = $_GET['foo'];


We use the common version standard, but slightly modified in some more detail as described in the Versioning System document.
Secondly we urge you as theme/module/add-on developers to use the same version scheme to provide you a more powerful integration through Dragonfly. Some of these integrations are "update recognition" and "theme upgrading (since 9.1.x)".

Updated: Wednesday, April 18, 2012 (06:20:51) by NanoCaiordo
Created:  Tuesday, November 29, 2005 (02:44:47) by DJMaze