Comments play a very important in both the phpBB source and in MOD scripts. Including documentation to explain what is going on will help users understand your code. EMC as much as possible attempts to accomodate the practice of documenting work with comments.
The least you need to know:
- Comment as much as you want in both the phpBB source and the MOD script
- comments in the MOD script can't breakup the command target (ie. the lines to FIND)
- For FINDs, it's helpful to include the original phpBB source line
- Inserting comments containing duplicate text of original phpBB source breaks FIND
- Any text (including duplicate code) will be ignored between /*-MOD and MOD-*/
Documenting MOD scripts
The more you can communicate to users trying to (manually) install your MOD the better. Comments in the MOD script are proceeded by a #. When including a comment, you should keep in mind that information between the last # of the command definition and the first # found thereafter limits the target of the command. For example...
Code: Select all
# you can put a comment anywhere in here
#
# you can put a comment anywhere in here
#-------[ FIND ]----------------------------------
# you can put a comment anywhere in here
#
# you can put a comment anywhere in here
#
1st line to find
2nd line to find
# WARNING :: WARNING :: WARNING putting a comment here will
# cause the 3rd and 4th lines to not be included in the FIND
3rd line to find
4th line to find
# you can put a comment here, now that you intend nothing else
# to be included in the FIND block
#
#-------[ next command ]-----------------------
There are several things you could leave in comments to help the user install the MOD. For instance when for IN-LINE commands it may be helpful to explain in the script what the resulting line will look like. Probably the most important thing to comment is the FIND command. Since with EMC you will only be stating fragements of lines, it will be very helpful to include in a comment exactly how the full line appears in the original phpBB source.
Inserting Comments into the phpBB source
When writing code to be inserted into PHP or TPL files, it is encouraged that you document your code as much as possible. Every Author has their own style and it is not my intent to tell anyone how their comments should look or when to use them. So again, just to emphasize, commenting the code that will be inserted into PHP and TPL files is encouraged.
However there is one practice that must be denied. Inserting comments into the code that contains duplicate (or near duplicate) text of original phpBB source cannot be allowed. For example if the original phpBB source line looks like this...
Code: Select all
$x = $y + $z ;
Code: Select all
$x = $y + $z + $foo ;
Code: Select all
// the original line was:
//$x = $y + $z ;
$x = $y + $z + $foo ;
An alternate solution
The EasyMOD program inserts bits of duplicate code into the source so that the uninstall feature may work. A convention is used so that EM will know to skip this block of code. Therefore, you may insert whatever comments you like, including duplicate code, if you use the EM convention. For PHP files, EM will skip any content between /*-MOD and MOD-*/ and all lines between these comments. Content on the same line as these markers will still be valid as long as the content lies outside of it. For TPL files, a similar convention is used: <!--MOD and MOD--> and lines with these markers operate in the same manner as the markers in the PHP files.
-Nuttzy