Welcome Guest, Not a member yet? Register   Sign In
Phil's template library is driving me crazy
#1

[eluser]xmonader[/eluser]
config template.php

Code:
<?php defined('BASEPATH') OR exit('No direct script access allowed');

/*
|--------------------------------------------------------------------------
| Parser Enabled
|--------------------------------------------------------------------------
|
| Should the Parser library be used for the entire page?
|
| Can be overridden with $this->template->enable_parser(TRUE/FALSE);
|
|   Default: TRUE
|
*/

$config['parser_enabled'] = TRUE;

/*
|--------------------------------------------------------------------------
| Parser Enabled for Body
|--------------------------------------------------------------------------
|
| If the parser is enabled, do you want it to parse the body or not?
|
| Can be overridden with $this->template->enable_parser(TRUE/FALSE);
|
|   Default: FALSE
|
*/

$config['parser_body_enabled'] = FALSE;

/*
|--------------------------------------------------------------------------
| Title Separator
|--------------------------------------------------------------------------
|
| What string should be used to separate title segments sent via $this->template->title('Foo', 'Bar');
|
|   Default: ' | '
|
*/

$config['title_separator'] = ' | ';

/*
|--------------------------------------------------------------------------
| Theme
|--------------------------------------------------------------------------
|
| Which layout file should be used? When combined with theme it will be a layout file in that theme
|
| Change to 'main' to get /application/views/main.php
|
|   Default: FALSE
|
*/

$config['layout'] = FALSE;

/*
|--------------------------------------------------------------------------
| Theme
|--------------------------------------------------------------------------
|
| Which theme to use by default?
|
| Can be overriden with $this->template->set_theme('foo');
|
|   Default: ''
|
*/

$config['theme'] = '';

/*
|--------------------------------------------------------------------------
| Theme
|--------------------------------------------------------------------------
|
| Where should we expect to see themes?
|
|    Default: array(APPPATH.'themes/' => '../themes/')
|
*/

$config['theme_locations'] = array(
    APPPATH.'themes/'
);

I've created a themes directory under application
Code:
$ pwd
/var/www/html/ciki3inst/application/themes

and created themes/install/views/layouts/default.php <layout>
Code:
$ tree
.
`-- install
    `-- views
        `-- layouts
            `-- default.php

Controller
Code:
&lt;?php if (!defined('BASEPATH')) exit('No direct script access allowed');

class Installer extends MX_Controller{
    
    function __construct(){
        parent::__construct();
        $this->template->set_theme("install");
        
    }
    
    function index(){
        
        //$this->template->set_layout("default"); //default.php is the default
        $this->template->set_partial("header", "header");
        $this->template->set_partial("footer", "footer");
        $this->template->build("installview");
      
    }
    
}

and it doesn't work!!
the only way to get it working is moving the layouts/default.php to application/views/layouts/default.php

and modifying the code like this
Code:
&lt;?php if (!defined('BASEPATH')) exit('No direct script access allowed');

class Installer extends MX_Controller{
    
    function __construct(){
        parent::__construct();
        //$this->template->set_theme("install");
        
    }
    
    function index(){
        
        $this->template->set_layout("default");
        $this->template->set_partial("header", "header");
        $this->template->set_partial("footer", "footer");
        $this->template->build("installview");
      
    }
    
}

Any thoughts ?




Theme © iAndrew 2016 - Forum software by © MyBB