The first step is to retrieve the values that might have been passed to the
from one PHP script to another:
_visuals.inc
file by one of the three ways variables can be passedfrom one PHP script to another:
- via the URL using an HTTP GET request (
myfile.php?key=value
); - using an HTTP POST request;
- or including (via the
include()/require()
function) the
visuals.inc
file so gaining visibility on the parent script
variables.
Since PHP 4.1, the way HTTP POST/GET request variables are handled has also
changed (we won’t discuss that here, refer to the PHP web site) and that’s the reason why the first step in the
script is, if the PHP version is not 4.1, creating and initialising a
HTTP_POST and GET arrays (used by former versions of PHP). This makes sure the
rest of the script can be developed following the latest recommendations of PHP
while still working fine on former versions (the test
not fully correct as also returning true for higher versions of PHP).
changed (we won’t discuss that here, refer to the PHP web site) and that’s the reason why the first step in the
script is, if the PHP version is not 4.1, creating and initialising a
$_REQUEST
array (PHP 4.1 compliant behavior) containing theHTTP_POST and GET arrays (used by former versions of PHP). This makes sure the
rest of the script can be developed following the latest recommendations of PHP
while still working fine on former versions (the test
!= '4.1'
isnot fully correct as also returning true for higher versions of PHP).
The next step is making sure that whatever value passed to the
account. The only value that we will use is the
referencing the id of the visual set to load. The code first checks if a value
is passed via HTTP POST or GET request (using the
initialised sooner), if no checks that the variable is not yet defined by a
parent script (assuming
required by another script) and if none of those scenarios are true, finally
give the
visuals.inc
file in whatever way (see above) is always taken intoaccount. The only value that we will use is the
$SkinID
that isreferencing the id of the visual set to load. The code first checks if a value
is passed via HTTP POST or GET request (using the
$_REQUEST
initialised sooner), if no checks that the variable is not yet defined by a
parent script (assuming
visuals.inc
might have been included orrequired by another script) and if none of those scenarios are true, finally
give the
$SkinID
variable a default value equal to 0. Finally comes the definition of the visuals parameters and for this example I
limited their number to four: font, font size, font unit and page background
color. I recommend that, when naming the first dimension of the
page. Let’s imagine that you define visual parameter for the footer section of
your web then declare a
limited their number to four: font, font size, font unit and page background
color. I recommend that, when naming the first dimension of the
$VISUALS
array, you link it to structural elements of your webpage. Let’s imagine that you define visual parameter for the footer section of
your web then declare a
$VISUALS[0]['footer']
dimension. The
stylesheet.
visuals.inc
file is now ready; let’s move on to thestylesheet.