README

CssDispatcher v0.1
===============================================================================

Welcome to CssDispatcher, a templated CSS processing library. It's very simple,
you could have written it, but I did it for you ;-) and it's designed to be 
adapted to any framework or methodology you use. 

CssDispatcher provides you two simple classes: Css and CssDispatcher.


Css class
-------------------------------------------------------------------------------

The Css class wraps a stylesheet. You can instantiate it by specifying its file
name:

$layout = new Css("layout.css.php");

(I recommend you to use the ".css.php" suffix)

So you can add variables to your template by dynamic typing:

$layout->main_color = '#eee';
$layout->float = 'float: left';

You can instantiate a new CssDispatcher and add the previous template:

$css = new CssDispatcher;
$css->add($layout);

And finally, of course you can dispatch the stylesheet:

$css->render();

You can also add stylsheets for specific browsers, by adding a parameter to the
Css class constructor:

$ie_hacks = new Css('ie-hacks.css', Css::UA_IE6);

So this stylesheet will be only added to Dispatcher output when the user's 
current browser is Internet Explorer 6. You can get the complete list of 
available user agents in the phpDocumentation (Css class constants).


Caching, compression and other performance improvements
-------------------------------------------------------------------------------

See "Server configurations" sectionYou can use, modify and redistribute it under the terms of the GNU General 
Public License (v2).



Server configurations
-------------------------------------------------------------------------------

CssDispatcher does not provides a framework to manage all your stylesheets 
aspects. You can use the library in any web server that supports PHP, but I
recommend (and CssLibrary was coded under) Apache.

For caching and compression, CssDispatcher does not provide any specific
solution, so you can use which you want: standard caching systems, manual
compression (with header(), output buffers and gzip functions), server-specific
solutions, etc. Personally, I like Apache's mod_deflate.

To hide the CSS templates from the public access, you can use your
favourite method, but I recommend .htacces deny:

[Files *.css.php]
deny from all
[/Files]

You can use URL-rewriting or any other method. You can even allow the public 
access to the templates (they will be compiled by PHP and they may cause
errors, exposing probably insecure information about your web server).


More information
-------------------------------------------------------------------------------

CssDispatcher was written by Israel Viana. You can find more information about
the library and its author at http://israelviana.es.


License
-------------------------------------------------------------------------------

Remember that CssDispatcher is free software under the terms of the GNU General
Public License (see LICENSE file for the complete license terms).

Documentation generated on Tue, 25 Aug 2009 12:42:21 +0200 by phpDocumentor 1.4.2