Setting up PHP-SmartCSS is very easy. Just follow these simple instructions and you'll be ready to use PHP-SmartCSS in a few minutes.
Installation
To setup PHP-SmartCSS, you simply need to unpack the package into your web site main directory, including the main "PHP-SmartCSS" folder and to add the following few lines into the header of your (X)HTML pages.<?php
require_once 'PHP-SmartCSS/PHP-SmartCSS.starter.php';
?>
By default, all of the CSS files you would like PHP-SmartCSS to take care of, should be placed in the "PHP-SmartCSS/css" subdirectory. The (X)HTML files or the PHP file requiring them (in the case you use a templating system) should be placed at the same depth level as the "PHP-SmartCSS" folder. Please remember the folder "PHP-SmartCSS/css_c/" must be writable to all of the users (CHMOD 0777).
[ WEB ROOT ]
|
|
|____ [ PHP-SmartCSS ]
| |
| |
| |____ [ css ]
| |
| |
| |____ [ css_c ] (CHMOD=0777)
|
|
|____ [ index.php ]
|
|
|____ [ PHP-SmartCSS ]
| |
| |
| |____ [ css ]
| |
| |
| |____ [ css_c ] (CHMOD=0777)
|
|
|____ [ index.php ]
System requirements dependency!
Setup or local execution of PEAR class Net_UserAgent_Detect is mandatory in order to use PHP-SmartCSS (please refer to this HOWTO).Usage examples
Usage example 1 (default HTML inclusion):<html>
<head>
<?php
require_once 'PHP-SmartCSS/PHP-SmartCSS.easystart.php';
?>
</head>
<body></body>
</html>
Usage example 2 (selective HTML inclusion):
<html>
<head>
<?php
require_once 'PHP-SmartCSS/PHP-SmartCSS.class.php';
$obj = new PHP-SmartCSS;
$obj -> getCSS('stylesheet1.css');
$obj -> getCSS('stylesheet2.css');
$obj -> getCSS('stylesheet3.css');
?>
</head>
<body></body>
</html>
Now, we're going to learn some PHP-SmartCSS syntax .