]> CyberLeo.Net >> Repos - SourceForge/phpwiki.git/blob - doc/README.coding
Added/changed info specific to wiki 1.3 branch pertinent to Mac OS X.
[SourceForge/phpwiki.git] / doc / README.coding
1 Here are the coding guidelines for PhpWiki.
2
3 ! Follow the style of the PEAR Coding Standards: 
4 * http://www.php.net/manual/en/pear.standards.php
5 There's code snippets for configuring Emacs and Vim as well as several
6 other text editors.
7
8 ! I18N: Using gettext()
9
10 String literals which end up making it into the HTML output should be wrapped
11 with a call to ''gettext()''.  This allows translations to be substituted when 
12 PhpWiki is run in non-english environments.
13
14 It is important that the argument of ''gettext()'' be a constant string
15 literal, in double quotes (").
16
17  OKAY:  gettext("This is a message.");
18  OKAY:  gettext ("Fazool."); 
19  OKAY:  sprintf(gettext("Hello %s"), $name);
20
21  BAD:   gettext('This will be ignored by xgettext.');
22  BAD:   gettext("Howdy" . ", wazoo");
23  BAD:   gettext("Hello $name");
24  BAD:   define("MES", "howdy");  gettext(MES);
25
26 For editing files in Emacs, set indent-tabs-mode to nil. Some people
27 argue that it's better to use tabs and let people set their tab width,
28 but I think we're better off using just spaces because aligned
29 comments in the right region will not align correctly. For a detailed
30 argument see http://www.jwz.org/doc/tabs-vs-spaces.html.
31
32 Use php-mode as well. This is freely available on the net
33 (http://www.ontosys.com/src/php-mode.el). Put something like this
34 in your .emacs file:
35
36  (load "your-path-to-lisp-files/php-mode")
37  (setq auto-mode-alist
38        (append '(
39                  ("\\.php\\d?\\'" . php-mode)) auto-mode-alist))
40
41 so when you open .php files in Emacs it will start PHP mode
42 automatically.
43
44 There is another php-mode.el I have not tried:
45 http://sourceforge.net/projects/php-mode/
46
47 I'm sure Vim has a similar mode, if someone would let us know I'll add
48 it to this README.
49