Personally I prefer code like this:
PHP Code:
# * Function: make_uppercase
# Description: Take a string, $str, and return
# it, completely in capital letters
function make_uppercase($str) {
return strtoupper($str); # comment (note 8-space tab on this line)
}
I document functions with "# *" so I can easily search through and print out only subroutines. This is a big help in some of my projects where I can have nearly 100 subs in a single file.
I use the following comment types in my code:
PHP Code:
# * function
# & what the whole file does
# $ last time modified (filled in by CVS)
# normal comment
# % information about stuff that needs to be added
And I use this file structure:
/index.pl - most of the stuff is passed through the querystring (no need for separate files)
/res/ - Short for "resources"
-----/img/ - Images
-----/inc/ - Include files
-----/css/ - CSS files
-----/tmpl/ - Templates
-----/logs/ - Logs
/admin/index.pl - For admin tasks
Other people tend to catch on to my commenting style pretty quickly. That's pretty much the only non-ordinary thing I do in my code.
Bookmarks