March, 2012
The rule based themes plugin provides a mechanism to define rules that are applied via rbtme_get_theme() to return a theme string that can be used, for example, in a body class.
Rules are stored within rules.php (a file created/modified by the plugin when rules are saved). This file stores the rules as a PHP associative array with the file actually included at runtime avoiding any database queries when processing the final result.
Both the rules.php file and the '/cache' folder (which stores cached results from api calls) within the plugin directory must be writable by PHP. Similarly curl must be enabled on the server to allow the retrieval of remote xml.
rbtme_get_rule_list() can be used in templates if a listing of the currently available rules is required.
A rule can be any combination of these sub-rule types in a boolean 'and' style. Boolean 'or' is achieved by having multiple rules with the same output value.
The reference example is the Headscape Barn site that uses it to swap out the Pixel Art header.
Rules include the use of the unofficial google weather api to render rain and snow.
All portfolio content is copyright and cannot be reproduced without express persmission. These pages include both previously implemented and partially designed websites as well as university and exemplar projects.