File: README.coding

package info (click to toggle)
phpwiki 1.3.12p3-5etch1
  • links: PTS
  • area: main
  • in suites: etch
  • size: 16,956 kB
  • ctags: 21,608
  • sloc: php: 82,335; xml: 3,840; sh: 1,522; sql: 1,198; perl: 625; makefile: 562; awk: 28
file content (84 lines) | stat: -rw-r--r-- 2,892 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84

Here are the coding guidelines for PhpWiki.

!!! Code Indentation Style

We follow, for the most part, the PEAR coding standards:

    <http://www.php.net/manual/en/pear.standards.php>

There's code snippets for configuring Emacs and Vim as well as several
other text editors at the above URL.

!! Emacs Users

For editing files in Emacs, set indent-tabs-mode to nil. Some people
argue that it's better to use tabs and let people set their tab width,
but I think we're better off using just spaces because aligned
comments in the right region will not align correctly. For a detailed
argument see <http://www.jwz.org/doc/tabs-vs-spaces.html>.  Also use a
tab-width of eight, so that just in case tabs do creep into the source
code, they have a standard width.

Use php-mode as well. This is freely available on the net
<http://sourceforge.net/projects/php-mode/>. Put something like this
in your .emacs file:

 (autoload 'php-mode "php-mode" "PHP editing mode" t)
 (add-to-list 'auto-mode-alist '("\\.php\\d?$" . php-mode))
 (add-hook 'php-mode-hook
	   (lambda ()
	     (c-set-style "gnu")
	     ;; This syntax table mod makes the second line in:
	     ;; 
	     ;;   function( $arg1,
	     ;;             $arg2 );
	     ;;
	     ;; Line up correctly.
	     ;;
	     (modify-syntax-entry ?$ "'" php-mode-syntax-table)
	     (set (make-local-variable 'tab-width) 8)
	     (set (make-local-variable 'c-basic-offset) 4)
	     (set (make-local-variable 'c-hanging-comment-ender-p) 'nil)
	     (set (make-local-variable 'indent-tabs-mode) 'nil)))


!!! I18N: Using gettext()

String literals which end up making it into the HTML output should be
wrapped with a call to ''gettext()''.  This allows translations to be
substituted when PhpWiki is run in non-english environments.

Since xgettext (part of the "GNU gettext utilities") is used to find
strings for translation, It is important that the argument of
''gettext()'' be a constant string literal, in double quotes (").

Remember that xgettext only knows about c/c++ line-continuation
strings, it does not know about php's dot operator.

You can now use _("foo") as an alias for gettext("foo").

 OKAY:  gettext("This is a message.");
 OKAY:  _("Fazool."); 
 OKAY:  sprintf(_("Hello %s"), $name);
 OKAY:  sprintf(_("Hello %s"), $name);

 BAD:   _('This will be ignored by xgettext.');
 BAD:   _("Howdy" . ", wazoo");
 BAD:   _("Hello $name");
 BAD:   define("MES", "howdy");  gettext(MES);
 BAD:   _($string);

If you want Emacs po mode to automatically kick-in when you edit a po
file, add the following to your .emacs file:

 (setq auto-mode-alist
       (cons '("\\.po[tx]?\\'\\|\\.po\\." . po-mode) auto-mode-alist))
 (autoload 'po-mode "po-mode")

!!! Mac OS X: Project Builder

See INSTALL.MacOSX for instructions on using Project Builder with
PhpWiki and SourceForge.

$Id: README.coding,v 1.5 2002/01/05 10:32:16 carstenklapp Exp $