Recommend this page to a friend! |
Download .zip |
Info | Documentation | View files (5) | Download .zip | Reputation | Support forum | Blog | Links |
Last Updated | Ratings | Unique User Downloads | Download Rankings | |||||
2022-10-21 (28 days ago) | Not enough user ratings | Total: 185 This week: 1 | All time: 8,590 This week: 491 |
Version | License | PHP version | Categories | |||
ci-theme 1.0.1 | MIT/X Consortium ... | 5 | HTML, PHP 5, Libraries |
Description | Author | |||||||||||||
This class can generate HTML for CodeIgniter application themes. |
|
Provides a simple way to implement a theme based website or app using Codeigniter.
From version 1.5 it supports the Template Parser Class, with `
$this->theme->parse()`
method.
Fork this project (or download it), and copy its content into your Codeigniter app, under `
application`
folder.
For example:
/ (project root directory)
/application
--/config
--/libraries
--/themes
-- ...
There are some basic settings that you can change.
All these settings are located on `
./application/config/theme.php`
// --------------------------------------------
// The varname that you'll call on
// your files to output the processed content.
// --------------------------------------------
$config['output_var_name'] = 'outputs';
// --------------------------------------------
// Where theme files are placed ...
// --------------------------------------------
$config['theme_path'] = '../themes/';
Create your theme file such as ...
I.e: `
./application/themes/mytheme.php`
<!DOCTYPE html>
<html>
<head>
<title >Sample Theme for CI-Theme</title>
<link href="images/favicon.ico" rel="icon" type="image/x-icon" >
</head>
<body >
<?php echo $outputs; # here goes the content ... ?>
</body>
</html>
It's very simple. Have a look:
$ci =& get_instance();
$ci->load->library('theme');
$ci->theme->load('mytheme', 'path/to/view');
In the same way you can pass other parameters when loading a default codeigniter view file, you can pass another 2 additional params here.
$ci->theme->load('mytheme', 'path/to/view', $vars, FALSE);
or parse a template style view (containing pseudo-variables), using:
$ci->theme->parse('mytheme', 'path/to/view', $vars, FALSE);
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.
There some methods that can be used:
Sets a new variable data to be passed for theme output.
Loads a view with a given theme.
Parse a view with a given theme, using the Template Parser Class.
It's a static method.
Sets CSS files to be outputed into theme files.
It's a static method.
Sets JS files to be outputed into theme files.
It'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:
path/to/file1,path/to/file2, ...
It'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:
path/to/file1,path/to/file2, ...
It'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:
* name
* property
* http-equiv
I.e:
Theme::set_metatag( array('name' => 'robots', 'content' => 'all') ); // or
Theme::set_metatag( array('property' => 'og:title', 'content' => 'My Title') ); // or
Theme::set_metatag( array('http-equiv' => 'Content-Type', 'content' => 'text/html; charset=utf-8') );
It's a static method.
Set the metatag title.
It's a static method.
Set the metatag description.
It's a static method.
Set the metatag keywords.
It's a static method.
Set the metatag author.
It's a static method.
Set the metatag publisher.
It's a static method.
Set the metatag generator.
It'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.
It's a static method.
Set the metatag robots.
It's a static method.
Set metatags for Open Graph.
It's a static method.
Set metatags for Facebook Open Graph.
It's a static method.
Retrieve a string with all set metatags.
<?php echo Theme::metatag(); ?>
And the result should be something like:
<meta charset="utf-8" >
<title>Your title here</title>
<meta name="description" content="..." >
<meta name="keywords" content="..." >
<meta name="author" content="..." >
<meta name="publisher" content="..." >
<meta name="generator" content="..." >
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1, user-scalable=no" >
<meta name="robots" content="all" >
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" >
<meta http-equiv="Content-Style-Type" content="text/css" >
<meta property="og:title" content="..." >
<meta property="og:description" content="..." >
<meta property="og:name" content="..." >
<meta property="og:image" content="..." >
<meta property="og:site_name" content="..." >
<meta property="og:url" content="..." >
Report bugs, make suggestions and get involved on contributions.
Feel free to get in touch. ;)
Version Control | Unique User Downloads | Download Rankings | |||||||||||||||
100% |
|
|
Applications that use this package |
If you know an application of this package, send a message to the author to add a link here.