PHP Classes

File: v2/examples/example2.php

Recommend this page to a friend!
  Classes of Thomas Björk  >  CSS parser  >  v2/examples/example2.php  >  Download  
File: v2/examples/example2.php
Role: Example script
Content type: text/plain
Description: Example script
Class: CSS parser
CSS parser class
Author: By
Last change: Added compatibility to use semi-colons within parenthesises. A semi-colon is not considered a terminator it inside a single quote '...;...', a double quote "...;..." or within a pair of parenthesis (...;...)
Added a few examples
Date: 8 months ago
Size: 657 bytes
 

Contents

Class file image Download
<?php
// This is a simple example that loads two css files and joins them into
// one combined css

// Include the parser
include('../cssparser.php');
// Create an instance of the parser
$css = new CSSParser();
// Read the first css
$data1 = file_get_contents('./css1.css');
// Add the css data to the parser
$cssIndex = $css->ParseCSS($data1);
// Print out the current css
echo "<pre>";
echo
$css->GetCSS($cssIndex);
echo
"</pre>";
// Read the second css
$data2 = file_get_contents('./css2.css');
// Add the css to the parser
$css->ParseCSSAppend($cssIndex, $data2);
// Print out the combined css
echo "<pre>";
echo
$css->GetCSS($cssIndex);
echo
"</pre>";

For more information send a message to info at phpclasses dot org.