using require_login() and isadmin(), isteacher(), iscreator() or isstudent().</li>
<li class="spaced">All access to databases should use the functions in lib/datalib.php
whenever possible - this allows compatibility across a wide range of databases.
- You should find that almost anything is possible using these functions. Any
- other SQL statements should be: cross-platform; restricted to specific functions
- within your code (usally a lib.php file); and clearly marked.</li>
+ You should find that almost anything is possible using these functions. If you must write SQL code then make sure it is: cross-platform; restricted to specific functions
+ within your code (usually a lib.php file); and clearly marked.</li>
<li class="spaced">Don't create or use global variables except for the standard
$CFG, $SESSION, $THEME and $USER.</li>
<li class="spaced">All variables should be initialised or at least tested for
Don't use tabs AT ALL. </li>
<li class="spaced"><strong>Variable names</strong> should always be easy-to-read,
meaningful lowercase English words. If you really need more than one word
- then run them together, but keep them short as possible.
+ then run them together, but keep them short as possible. Use
+plural names for arrays of objects.
<p class="examplecode"><font color="#006600">GOOD: $quiz<br>
GOOD: $errorstring<br>
+GOOD: $assignments (for an array of objects)<br>
GOOD: $i (but only in little loops)<br>
<br />
BAD: $Quiz <br>
} </font></p>
</li>
</ol>
-<p align="center" class="normaltext"> </p>
<hr>
<p align="CENTER"><font size="1"><a href="." target="_top">Moodle Documentation</a></font></p>
<p align="CENTER"><font size="1">Version: $Id$</font></p>