Themes - Development
What templates do I need to have to develop a theme?
Please take a look at the page on templates for information on templates required for your theme.
How to create a Theme?
In order to create a theme please follow these steps:
- Create a new folder named whatever you want to call your theme in "clancms/views/themes/"
- Create template files for the required templates
- Change the theme setting in "Site Settings" to the name of your new folder.
- Your theme should now be loaded and able to use!
How to create a Template?
In order to create a template please follow these steps:
- Create a new php file named after the template in your theme's folder (clancms/views/themes/YOUR_THEME)
- Load the header, sidebar, widgets, footer in the template file. (See example below)
- Verify that the template has everything it erquires to work properly.
How to load a template in another template
Template's are also known as views and here is an example of how to load a view:
<?php
// Load the header view
$this->load->view(THEME . 'header');
?>
- THEME is a constant variable that is used to load the template for the theme that is set. It is a required for a template to be loaded.
- header is where you put the name of the template file without the ".php" extension.
How to load a widget in a template
<?php
// Load the login widget
$this->load->widget('login');
?>
- Loading a widget will only work if a widget template has been created in the "clancms/views/themes/YOUR_THEME/widgets" folder.
- login is where you put the name of the wdiget template file without the ".php" extension.
Global Variables
CLAN_NAME
The name of the clan.<?php
echo 'Thank you for registering with ' . CLAN_NAME;
?>
THEME
The relative link to the folder of the theme which is used for loading views.<?php
$this->load->view(THEME . 'header');
?>
THEME_URL
The full path to the folder of the theme which is used for showing images, including css, including javascript, etc.<link href="<?php echo THEME_URL; ?>style.css" rel="stylesheet" type="text/css" />
<img src="<?php echo THEME_URL; ?>images/logo.png" title="Logo" alt="Logo" />
IMAGES
The full path to the folder containing uploaded images.<img src="<?php echo IMAGES; ?>/avatars/avatar.png" title="Avatar" alt="Avatar" />

