Recommend this page to a friend! |
Download .zip |
Info | View files (8) | Download .zip | Reputation | Support forum | Blog (1) | Links |
Last Updated | Ratings | Unique User Downloads | Download Rankings | |||||
2009-10-21 (7 years ago) | Not yet rated by the users | Total: 352 | All time: 6,591 This week: 1,050 |
Version | License | PHP version | Categories | |||
css-dispatcher 1.0 | GNU Lesser Genera... | 5.0 | PHP 5 |
Description | Author | |
This package can be used to compose CSS style sheets from multiple templates. |
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). |
Files |
File | Role | Description |
---|---|---|
class.Css.php | Class | Css class (auxiliar) |
class.CssDispatcher.php | Class | Main class |
example.css.php | Aux. | templated CSS |
example.php | Example | Example of CssDispatcher |
example2.css.php | Aux. | Another example of templated CSS |
INSTALL | Doc. | Installation instructions |
LICENSE | Lic. | LGPL License text |
README | Doc. | Some important information |
Version Control | Unique User Downloads | Download Rankings | |||||||||||||||
0% |
|
|
Applications that use this package |
If you know an application of this package, send a message to the author to add a link here.