03: I need (white)space!

This is a temporary forum setup for the purpose of discussing the EMC standards
Locked
Nuttzy99
Registered User
Posts: 927
Joined: Fri Aug 03, 2001 7:09 am
Contact:

03: I need (white)space!

Post by Nuttzy99 »

I need (white)space!

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
[/b]
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
Whitespace Sensitive Commands
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 :cool:
SpellingCow.com - Free spell check service for your forums or any web form!
My Other Site

Xore
Registered User
Posts: 80
Joined: Mon Jul 21, 2003 11:44 pm
Location: The desert
Contact:

Re: 03: I need (white)space!

Post by Xore »

point of notice, you missed one of the standard MOD Template actions... COPY.

I'm assuming this is whitespace insensitive, but just to be sure...

Code: Select all

# 
#-----[ COPY ]------------------------------------------ 
#
copy cash.php                                      to cash.php
copy includes/functions_cash.php                   to includes/functions_cash.php
copy admin/admin_cash.php                          to admin/admin_cash.php
copy admin/cash_config.php                         to admin/cash_config.php
copy admin/cash_currencies.php                     to admin/cash_currencies.php
copy admin/cash_exchange.php                       to admin/cash_exchange.php
copy admin/cash_forums.php                         to admin/cash_forums.php
copy admin/cash_groups.php                         to admin/cash_groups.php
copy admin/cash_help.php                           to admin/cash_help.php
copy admin/cash_log.php                            to admin/cash_log.php
copy admin/cash_settings.php                       to admin/cash_settings.php
copy language/lang_english/lang_cash.php           to language/lang_english/lang_cash.php
copy templates/subSilver/exchange_body.tpl         to templates/subSilver/exchange_body.tpl
copy templates/subSilver/admin/cash_config.tpl     to templates/subSilver/admin/cash_config.tpl
copy templates/subSilver/admin/cash_config.tpl     to templates/subSilver/admin/cash_config.tpl
copy templates/subSilver/admin/cash_currencies.tpl to templates/subSilver/admin/cash_currencies.tpl
copy templates/subSilver/admin/cash_exchange.tpl   to templates/subSilver/admin/cash_exchange.tpl
copy templates/subSilver/admin/cash_forum.tpl      to templates/subSilver/admin/cash_forum.tpl
copy templates/subSilver/admin/cash_groups.tpl     to templates/subSilver/admin/cash_groups.tpl
copy templates/subSilver/admin/cash_group.tpl      to templates/subSilver/admin/cash_group.tpl
copy templates/subSilver/admin/cash_help.tpl       to templates/subSilver/admin/cash_help.tpl
copy templates/subSilver/admin/cash_log.tpl        to templates/subSilver/admin/cash_log.tpl
copy templates/subSilver/admin/cash_menu.tpl       to templates/subSilver/admin/cash_menu.tpl
copy templates/subSilver/admin/cash_settings.tpl   to templates/subSilver/admin/cash_settings.tpl
and

Code: Select all

# 
#-----[ COPY ]------------------------------------------ 
#
copy cash.php to cash.php
copy includes/functions_cash.php to includes/functions_cash.php
copy admin/admin_cash.php to admin/admin_cash.php
copy admin/cash_config.php to admin/cash_config.php
copy admin/cash_currencies.php to admin/cash_currencies.php
copy admin/cash_exchange.php to admin/cash_exchange.php
copy admin/cash_forums.php to admin/cash_forums.php
copy admin/cash_groups.php to admin/cash_groups.php
copy admin/cash_help.php to admin/cash_help.php
copy admin/cash_log.php to admin/cash_log.php
copy admin/cash_settings.php to admin/cash_settings.php
copy language/lang_english/lang_cash.php to language/lang_english/lang_cash.php
copy templates/subSilver/exchange_body.tpl to templates/subSilver/exchange_body.tpl
copy templates/subSilver/admin/cash_config.tpl to templates/subSilver/admin/cash_config.tpl
copy templates/subSilver/admin/cash_config.tpl to templates/subSilver/admin/cash_config.tpl
copy templates/subSilver/admin/cash_currencies.tpl to templates/subSilver/admin/cash_currencies.tpl
copy templates/subSilver/admin/cash_exchange.tpl to templates/subSilver/admin/cash_exchange.tpl
copy templates/subSilver/admin/cash_forum.tpl to templates/subSilver/admin/cash_forum.tpl
copy templates/subSilver/admin/cash_groups.tpl to templates/subSilver/admin/cash_groups.tpl
copy templates/subSilver/admin/cash_group.tpl to templates/subSilver/admin/cash_group.tpl
copy templates/subSilver/admin/cash_help.tpl to templates/subSilver/admin/cash_help.tpl
copy templates/subSilver/admin/cash_log.tpl to templates/subSilver/admin/cash_log.tpl
copy templates/subSilver/admin/cash_menu.tpl to templates/subSilver/admin/cash_menu.tpl
copy templates/subSilver/admin/cash_settings.tpl to templates/subSilver/admin/cash_settings.tpl
are equivalent?

Nuttzy99
Registered User
Posts: 927
Joined: Fri Aug 03, 2001 7:09 am
Contact:

Re: 03: I need (white)space!

Post by Nuttzy99 »

Heh, this wasn't true until a month or two ago when I looked at the Attach MOD script. I decided it would be best to allow the pretty formatting that Acyd was using ;)

Hrmmmm... this is correct but it only applies to the COPY command. I really want to focus on the whitespace lines plus leading and trailing whitespace. I don't want to confuse people, but I'll consider adding this for the sake completeness.

Thanks!
-Nuttzy :cool:
SpellingCow.com - Free spell check service for your forums or any web form!
My Other Site

Nuttzy99
Registered User
Posts: 927
Joined: Fri Aug 03, 2001 7:09 am
Contact:

Re: 03: I need (white)space!

Post by Nuttzy99 »

Sorry, was just testing the bump feature. It works :P

-Nuttzy :cool:
SpellingCow.com - Free spell check service for your forums or any web form!
My Other Site

User avatar
-=ET=-
Registered User
Posts: 214
Joined: Mon May 26, 2003 1:35 pm
Location: France

Re: 03: I need (white)space!

Post by -=ET=- »

Nuttzy99 wrote:Sorry, was just testing the bump feature. It works :P
lol ;)
Eternal newbie

gamerxgirl
Registered User
Posts: 10
Joined: Tue Feb 22, 2005 7:35 pm

Re: 03: I need (white)space!

Post by gamerxgirl »

Xore wrote: point of notice, you missed one of the standard MOD Template actions... COPY.

I'm assuming this is whitespace insensitive, but just to be sure...

Code: Select all

# 
#-----[ COPY ]------------------------------------------ 
#
copy cash.php                                      to cash.php
copy includes/functions_cash.php                   to includes/functions_cash.php
copy admin/admin_cash.php                          to admin/admin_cash.php
copy admin/cash_config.php                         to admin/cash_config.php
copy admin/cash_currencies.php                     to admin/cash_currencies.php
copy admin/cash_exchange.php                       to admin/cash_exchange.php
copy admin/cash_forums.php                         to admin/cash_forums.php
copy admin/cash_groups.php                         to admin/cash_groups.php
copy admin/cash_help.php                           to admin/cash_help.php
copy admin/cash_log.php                            to admin/cash_log.php
copy admin/cash_settings.php                       to admin/cash_settings.php
copy language/lang_english/lang_cash.php           to language/lang_english/lang_cash.php
copy templates/subSilver/exchange_body.tpl         to templates/subSilver/exchange_body.tpl
copy templates/subSilver/admin/cash_config.tpl     to templates/subSilver/admin/cash_config.tpl
copy templates/subSilver/admin/cash_config.tpl     to templates/subSilver/admin/cash_config.tpl
copy templates/subSilver/admin/cash_currencies.tpl to templates/subSilver/admin/cash_currencies.tpl
copy templates/subSilver/admin/cash_exchange.tpl   to templates/subSilver/admin/cash_exchange.tpl
copy templates/subSilver/admin/cash_forum.tpl      to templates/subSilver/admin/cash_forum.tpl
copy templates/subSilver/admin/cash_groups.tpl     to templates/subSilver/admin/cash_groups.tpl
copy templates/subSilver/admin/cash_group.tpl      to templates/subSilver/admin/cash_group.tpl
copy templates/subSilver/admin/cash_help.tpl       to templates/subSilver/admin/cash_help.tpl
copy templates/subSilver/admin/cash_log.tpl        to templates/subSilver/admin/cash_log.tpl
copy templates/subSilver/admin/cash_menu.tpl       to templates/subSilver/admin/cash_menu.tpl
copy templates/subSilver/admin/cash_settings.tpl   to templates/subSilver/admin/cash_settings.tpl
and

Code: Select all

# 
#-----[ COPY ]------------------------------------------ 
#
copy cash.php to cash.php
copy includes/functions_cash.php to includes/functions_cash.php
copy admin/admin_cash.php to admin/admin_cash.php
copy admin/cash_config.php to admin/cash_config.php
copy admin/cash_currencies.php to admin/cash_currencies.php
copy admin/cash_exchange.php to admin/cash_exchange.php
copy admin/cash_forums.php to admin/cash_forums.php
copy admin/cash_groups.php to admin/cash_groups.php
copy admin/cash_help.php to admin/cash_help.php
copy admin/cash_log.php to admin/cash_log.php
copy admin/cash_settings.php to admin/cash_settings.php
copy language/lang_english/lang_cash.php to language/lang_english/lang_cash.php
copy templates/subSilver/exchange_body.tpl to templates/subSilver/exchange_body.tpl
copy templates/subSilver/admin/cash_config.tpl to templates/subSilver/admin/cash_config.tpl
copy templates/subSilver/admin/cash_config.tpl to templates/subSilver/admin/cash_config.tpl
copy templates/subSilver/admin/cash_currencies.tpl to templates/subSilver/admin/cash_currencies.tpl
copy templates/subSilver/admin/cash_exchange.tpl to templates/subSilver/admin/cash_exchange.tpl
copy templates/subSilver/admin/cash_forum.tpl to templates/subSilver/admin/cash_forum.tpl
copy templates/subSilver/admin/cash_groups.tpl to templates/subSilver/admin/cash_groups.tpl
copy templates/subSilver/admin/cash_group.tpl to templates/subSilver/admin/cash_group.tpl
copy templates/subSilver/admin/cash_help.tpl to templates/subSilver/admin/cash_help.tpl
copy templates/subSilver/admin/cash_log.tpl to templates/subSilver/admin/cash_log.tpl
copy templates/subSilver/admin/cash_menu.tpl to templates/subSilver/admin/cash_menu.tpl
copy templates/subSilver/admin/cash_settings.tpl to templates/subSilver/admin/cash_settings.tpl
are equivalent?
Not anymore, they are no longer pass the phpBB2 Mod Validator tool, the white space now needs to be gone, it can only be 1 space on either side of the 'to'.
---------------------------------
http://proud-nerd.net" target="_blank
http://html-girl.net" target="_blank
http://sims2sites.com" target="_blank

Locked