Login   Register  
PHP Classes
elePHPant
Icontem

File: README

Recommend this page to a friend!
Stumble It! Stumble It! Bookmark in del.icio.us Bookmark in del.icio.us
  Classes of khjk  >  CSS Dispatcher  >  README  >  Download  
File: README
Role: Documentation
Content type: text/plain
Description: Some important information
Class: CSS Dispatcher
Compose CSS style sheets from multiple templates
Author: By
Last change:
Date: 4 years ago
Size: 2,968 bytes
 

Contents

Class file image Download
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.php', 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" section.



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 Lesser
General Public License (see LICENSE file for the complete license terms).