Welcome Guest, Not a member yet? Register   Sign In
Colin Williams Template Library and themes
#1

[eluser]Unknown[/eluser]
I have been trying for the past couple of days to implement themes in <a href="http://www.williamsconcepts.com/ci/codeigniter/libraries/template/?v141">this</a> library, but somehow I can't get the variables set in the config array. I made a function called "set_theme" like this:
<code>
function set_theme($theme){
$this->config->set_item('theme', $theme);
}
</code>
and a variety:
<code>
function set_theme($theme){
$this->theme = $theme;
}
</code>
but neither seem to do any different...

and then in my Public_Controller I added:
<code>$this->template->set_theme($this->config->item('public_theme'));</code>

I have been trying to change the various functions to accept the theme folder, but i cant seem to get the variable into the $template string.

I added a <code>$template['use_theme'] = true</code> to the template config so it can swith between views and themes folders and that works in the function f. ex.

<code>
function initialize($props)
{
// Set master template
if($this->config['use_theme'] == true){
$folder = 'themes/'.$this->theme.'/';
} else {
$folder = 'views/';
}


if (isset($props['template']) && $this->_is_file($folder, $props['template'])Wink
{

$this->master = $folder.$props['template'];

}

else
{
// Master template must exist. Throw error.
show_error('Line 188: "'.$props['template'].'" Either you have not provided a master template or the one provided does not exist in <strong>'. APPPATH .$folder.'</strong>. Remember to include the extension if other than ".php"');
}

// Load our regions
if (isset($props['regions']))
{
$this->set_regions($props['regions']);
}

// Set parser and parser method
if (isset($props['parser']))
{
$this->set_parser($props['parser']);
}
if (isset($props['parser_method']))
{
$this->set_parser_method($props['parser_method']);
}

// Set master template parser instructions
$this->parse_template = isset($props['parse_template']) ? $props['parse_template'] : FALSE;
}</code>

what am i possibly doing wrong?? I keep getting this error:
<code>

An Error Was Encountered

Line 188: "template" Either you have not provided a master template or the one provided does not exist in application/themes//. Remember to include the extension if other than ".php"
</code>

I feel like i'm on the right track, but I'm not exactly a hardcore programmer so I may be off by a mile...




Theme © iAndrew 2016 - Forum software by © MyBB