Recommend this page to a friend! |
Classes of Rogério Taques | CodeIgniter Theme class | README.md | Download |
|
DownloadCI Theme 1.6.1 betaProvides a simple way to implement a theme based website or app using Codeigniter.
From version 1.5 it supports the Template Parser Class, with Getting StartedFork this project (or download it), and copy its content into your Codeigniter app, under For example:
ConfigThere are some basic settings that you can change. All these settings are located on
Theme fileCreate your theme file such as ... I.e:
Calling a themed pageIt's very simple. Have a look:
In the same way you can pass other parameters when loading a default codeigniter view file, you can pass another 2 additional params here.
or parse a template style view (containing pseudo-variables), using:
The third parameter should be an Array with all variables that you want to forward to view. The fourth parameter, if TRUE, ensure that return won't be outputed for browser, but will be returned as string instead. MethodsThere some methods that can be used: set( name : string, value : array ) : voidSets a new variable data to be passed for theme output. load( theme : string, view : string, view_data : array, return : boolean ) : void|stringLoads a view with a given theme. parse( theme : string, view : string, view_data : array, return : boolean ) : void|stringParse a view with a given theme, using the Template Parser Class. theme::set_css( css : string|array ) : voidIt's a static method. Sets CSS files to be outputed into theme files. theme::set_js( js : string|array ) : voidIt's a static method. Sets JS files to be outputed into theme files. theme::get_css( inline : boolean ) : array|stringIt's a static method. Get a list of CSS files. When inline param is TRUE, returns a string with all file names concatenated with comma (,). I.e:
theme::get_js( inline : boolean ) : array|stringIt's a static method. Get a list of JS files. When inline param is TRUE, returns a string with all file names concatenated with comma (,). I.e:
theme::set_metatag( element : array ) : voidIt's a static method. The CI-Theme allows you to manage the metatags that are placed into your HTML file. There are already a bunch of predefined metatags that you can use. This method set those metatags. The format of given element should be array( tag => '', content => '' ) and supported tags are:
I.e:
theme::set_title( str : string ) : voidIt's a static method. Set the metatag title. theme::set_description( str : string ) : voidIt's a static method. Set the metatag description. theme::set_keywords( piece : string|array ) : voidIt's a static method. Set the metatag keywords. theme::set_author( str : string ) : voidIt's a static method. Set the metatag author. theme::set_publisher( str : string ) : voidIt's a static method. Set the metatag publisher. theme::set_generator( str : string ) : voidIt's a static method. Set the metatag generator. theme::set_canonical( str : string ) : voidIt's a static method. Set the link rel canonical. It is very useful to let search engines know whenever your page is a variation from an original source within your site. theme::set_robots( piece : string|array ) : voidIt's a static method. Set the metatag robots. theme::set_opengraph( property : string, content : string) : voidIt's a static method. Set metatags for Open Graph. theme::set_fb_opengraph( property : string, content : string) : voidIt's a static method. Set metatags for Facebook Open Graph. theme::metatags( void ) : stringIt's a static method. Retrieve a string with all set metatags.
And the result should be something like:
Get involvedReport bugs, make suggestions and get involved on contributions. Feel free to get in touch. ;) |