Linux Counter Logo Coding Standards

The Linux Counter isn't very formal about coding. But people need to know some things.

Perl standards

The update functions of the counter are written in Perl. They use the homebrew module "FileTable.pm" for data access - mostly through the "Counter.pm" module. Do NOT update data in the DB outside this module!

PHP standards

The counter wants to move towards having all display pages in PHP.

These should be based on "phpinc/sample.php", which will give you the right header and footer.

The counter uses PHP sessions.

The counter should work with "register_globals" off. Use the data accessor functions in counter.php to get at data, NOT globvars!

Internationalization

The counter wants to be internationalized - this is a long battle.

At the moment, the easy way to do it is to first write a page in English in the standard counter, and then run the script "tools/internationalizewebpage" to generate a page in the internationalized version of the site. Then one needs to generate a new .po file, and have that translated (Patrick knows this one well).

Sooner or later, we'll have to change to working with the internationalized files.

State handling - EXPERIMENTAL

State is done with two variables in the session: A Perl CGI script should do its work, set "message" if there's any error or other thing to tell the user, and redirect the user back to "showpage".

If an error display page is needed for complex errors (or things not coded to this standard), this error display does NOT set "showpage".

If "showpage" is not set, and the user is logged in, control returns to "/person/".

If "showpage" is not set, and the user is NOT logged in, control returns to "/".

The standard coding for this in a PHP page is to call "iamashowpage()" just after "php include counter.php", and to call "showmessage() just after calling "pagetop()". Both functions are defined in counter.php.