Many Authors like to use whitespace to make their MOD scripts more readable. Whitespace is also used in the core phpBB code and must be dealt with by commands like FIND. The intention of this section is to state the role of whitespace throughout the MOD installation process.
The least you need to know:
- OPEN, FIND, and SQL are whitespace indifferent
- FINDs cannot depend on whitespace appearing in the FIND block
- IN-LINE commands are sensitive to leading and trailing but not empty lines
- REPLACE, AFTER, ADD, and BEFORE, ADD are concerned with everything involving whitespace
Whitespace Indifferent Commands
These commands literally ignore whitespace lines as well as leading and trailing whitespace. They include OPEN, FIND, and SQL. As far as EasyMOD is concerned, you may use as much or little whitespace in these commands as you feel is warranted to make your MOD script more readable. I always like to have a couple of blank lines to seperate one command from the next when possible.
For example, the following are equally acceptable and I suggest that the first is more readable:
Code: Select all
#
#-----------[ OPEN ] ------------------
#
file path and name
#
#-----------[ FIND ] ------------------
#
line to find
#
#-----------[ the next command ] ------------------
#
Code: Select all
#
#-----------[ OPEN ] ------------------
#
file path and name
#
#-----------[ FIND ] ------------------
#
line to find
#
#-----------[ the next command ] ------------------
#
It is very important to stress the implications this has for FIND ignoring whitespace. All three of the following code snipits are the same to EM, so it is important that your FIND is not depending on whitespace appearing in the FIND block....
Code: Select all
line 1
line 2
line 3
Code: Select all
line 1
line 2
line 3
Code: Select all
line 1
line 2
line 3
These commands are very much effected either whitespace lines, leading and trailing whitespace, or both. The IN-LINE commands are all sensitive to leading and trailing whitespace but since they are only concerned with a single line, whitespaces lines are ignored so that the Author may choose to increase readablity. It is important to note a key difference between IN-LINE FIND and FIND. FIND will strip-off leading and trailing whitespace, but since IN-LINE FIND is concerned with finding the precise location within a line, this whitespace cannot be ignored.
Commands including REPLACE, AFTER, ADD, and BEFORE, ADD are concerned with everything involving whitespace. These commands are injecting lines to the phpBB core code literally as they appear in the MOD script. Therefore Authors should not include any whitespace for these commands in the MOD script that they do not intend on appearing in the modified code.
-Nuttzy