• English
  • Nederlands

User Tools

Site Tools


en:php

You have to read (understand) this before adapting the scripts

Where are all your settings stored

  • All settings, including your changes, are stored in one table with the name $SITE[]
  • Every setting has its own name in the table: $SITE["name"]
  • en it has a value $SITE['name'] = "value"
  • In PHP such a "instruction" line is closed with a ;

So it should look like this:

$SITE["region"] 		= "europe";
  • The name of the setting in this example is region
  • The = character tells the script to fill the setting with the value after the =
  • The value of the setting with the name region thus becomes europe
  • In PHP this value stays the same until some other instruction-line changes the value.

A little more complex example

$SITE["region"] 		= "america";    // #####
#$SITE["region"] 		= "canada"; 	// #####
$SITE["region"] 		= "europe";	// #####
#$SITE["region"] 		= "other";      // #####

What does that # do?

The # character, is often found on the first position of a line. It is a comment character.
All remaining characters on the line are discarded / not parsed / used as comment.

  • The first line in this example sets the value of the setting region to "america"
  • All text on the second line is discarded as it starts with a #
  • The third line sets the value of the setting region to "europe"
  • And that value is the final value as the fourth line has a #

Why do we use the # character

Often there are long lists of possible values for one setting. The 'region' setting has only 4, but the weatherprogram setting has already 11. When we should type those values ourselves, typing errors would be generating lots of errors. Those "stupid" computers do not understand that when we type 'Europe' or 'europa' that value should be interpreted as 'europe'.

Thats why every "supported" value is written on its own line, and you only have to make sure that your value has NO # and all other values are commented out.

Only change a text when you are asked to do so.
Most of the times it is perfectly clear that you only have to remove / set a comment mark

Never ever change something you do not like or which looks like a typo without instructed to change the value . So do not change 'europe' into 'Europe' in the example. You will be faced with numerous error messages as a result of this improvement.

yes / no values

Most values of a setting are in the form of "value", so within quotes. The yes/no values are specified with the words true or false but without quotes.

$SITE["wsDebug"]         = true;         	##### 
#$SITE["wsDebug"]        = false;        	##### remove comment mark at position 1 when you are fully satisfied with your site.

The first line in this example sets the value of the setting wsDebug to true The second line in the example does nothing as it has a comment character on the first position. So all text after the # is discarded for now.
If we are ready with the implementation of the template we will remove that comment mark so that debugging mode is switched of. We could do that with one line only and type false where now it reads true, but you understand now that typing can result in typing errors and that we want to avoid that.

Typing your own values

# Contact page
$SITE["contactPage"]    = true;                 # true = Enable this page  |  false = Do not display
$SITE["contactName"]    = "your name to sign the emails";
$SITE["contactEmail"]   = "noreply@yourstation.com";
$SITE["contactEmailTo"] = "contact@yourstation.com";

Another part of the settings.
With the excveption of the true and false setting we encourage you to type all settings between quotes "xx". If you type and do not encloses the values between those quotes, you will be astonished by the number and tha ambiguity of the resulting messages.

Another reason to test often. A typo of one minute ago when you only changed a few lines is found "relative easy" . If you first test after half an hour adapting settings, you will face an enormous task.

Please remeber: If you do not want to use a setting you should leave the name of the setting as is, and set the value to an empty string. Also do not comment the line with the setting.

So this is NOT a good solution as it will result in "index contactName not defined" errors all around:

#$SITE["contactName"] 	= "your name";	

This is the correct solution, the field contactName still exists, so no error messages to be displayed, and it will not be shown on a pages as it is empty.

$SITE["contactName"] 	= "";	
en/php.txt · Last modified: 2015/12/02 07:13 by wvdkuil