CSSHandler (since version 2.0)
Type Component
Constants
integer ERROR_ILLEGALTOKEN = 1
Error code.
This code will be thrown by GetErrorCode method if an illegal token was found while parsing a CSS document.
This code will be thrown by GetErrorCode method if an illegal token was found while parsing a CSS document.
Methods
Description
The CSS handler provides the possibility to manipulate CSS documents very easy.
You can add or remove CSS classes and class properties in existing CSS documents.
You can add or remove CSS classes and class properties in existing CSS documents.
Examples
<?php
$css = BRICKOO::GetSingleton ('CSSHandler');
$styleSheet = "body
{
font-family: Arial;
font-size: 12px;
background-image: url(images/bg.png);
background-repeat: repeat-x;
/* A new property will be added here. */
}
.header
{
margin-LEFT: auto; /* Wrong. Will be fixed. */
margin-right: auto;
height: 80px;
width: 98%;
border: 1px solid #000000;
background-color: #FFFFFF;
background-image: url(images/logo.png);
background-repeat: no-repeat;
/* A new property will be added here. */
}
.content
{
margin-left: auto;
margin-right: auto;
width: 98%;
border: 1px solid #000000;
background-color: #eeeeee;
padding: 0px;
/* A new property will be added here. */
}";
header("Content-Type: text/plain");
$css->load ($styleSheet, true);
$css->setProperty ('body', 'color', '#000000');
$css->setProperty ('.header', 'color', '#000000');
$css->setProperty ('.content', 'color', '#000000');
$css->setProperty ('.content', 'margin-left', '0px');
echo $css->renderCSS (true);
?>
$css = BRICKOO::GetSingleton ('CSSHandler');
$styleSheet = "body
{
font-family: Arial;
font-size: 12px;
background-image: url(images/bg.png);
background-repeat: repeat-x;
/* A new property will be added here. */
}
.header
{
margin-LEFT: auto; /* Wrong. Will be fixed. */
margin-right: auto;
height: 80px;
width: 98%;
border: 1px solid #000000;
background-color: #FFFFFF;
background-image: url(images/logo.png);
background-repeat: no-repeat;
/* A new property will be added here. */
}
.content
{
margin-left: auto;
margin-right: auto;
width: 98%;
border: 1px solid #000000;
background-color: #eeeeee;
padding: 0px;
/* A new property will be added here. */
}";
header("Content-Type: text/plain");
$css->load ($styleSheet, true);
$css->setProperty ('body', 'color', '#000000');
$css->setProperty ('.header', 'color', '#000000');
$css->setProperty ('.content', 'color', '#000000');
$css->setProperty ('.content', 'margin-left', '0px');
echo $css->renderCSS (true);
?>
Last change 10/15/2009