Welcome Guest, Not a member yet? Register   Sign In
Using Assets for Template Library and Working With Layouts
#1

[eluser]xtremer360[/eluser]
I'm using Phil Sturgeon's template library and I'm trying to find out what asset library I should use with his library. Anybody know which works best with it?

Also, I am creating a layout for all my usermanagement forms like my forgot password form, login, register, etc.

This is how it looks so far. When I set this layout in my controller I get an undefined index body error. I'm not quite sure why this is. I have included the file location and controller code.

Login Controller:

Location: ../application/controllers/login.php

Theme Layout:

Location: ../application/themes/foobar/views/layouts/usermanagement.php

Login Form View:

Location: ../application/themes/foobar/views/login.php

Code:
<?php

if ( ! defined('BASEPATH')) exit('No direct script access allowed');

class Login extends Backend_Controller
{
    public function __construct()
    {
        parent::__construct();  
    }

    public function index()
    {  
        $this->template
             ->title('Login')
             ->set_layout('usermanagement')
             ->build('login');

            //echo '<pre>';
            //var_dump($this->template);
            //echo '</pre>';
            //die();
    }
}

Usermanagement Layout
Code:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

&lt;html &gt;

&lt;head&gt;

    &lt;meta http-equiv="Content-Type" c charset=utf-8" /&gt;

    &lt;title&gt;&lt;?php echo $template['title']; ?&gt;&lt;/title&gt;

&lt;/head&gt;

&lt;body class="usermanagement"&gt;

    <div class="container-fluid">

        <div id="header">

            <div class="row-fluid">

                <div class="navbar">

                    <div class="navbar-inner">

                        <div class="container">

                            <a class="brand" href="dashboard.html">

                                &lt;?php echo lang('global:site_name'); ?&gt;

                                <span class="slogan">

                                    &lt;?php echo lang('global:site_slogan'); ?&gt;

                                </span>

                            </a>

                        </div>&lt;!-- End .container --&gt;

                    </div>&lt;!-- End .navbar-inner --&gt;

                </div>&lt;!-- End .navbar --&gt;

            </div>&lt;!-- End .row-fluid --&gt;

        </div>&lt;!-- End #header --&gt;

    </div>&lt;!-- End .container-fluid --&gt;

    <div class="container-fluid">

        <div class="form-container">

            &lt;?php echo $template['body']; ?&gt;    

        </div>&lt;!-- End .form-container --&gt;

    </div>&lt;!-- End .container-fluid --&gt;

&lt;/body&gt;
#2

[eluser]Aken[/eluser]
How do you not know what an undefined index error is by now? You're calling $template['body'] and it doesn't exist...

Why do you want or need an asset library?
#3

[eluser]xtremer360[/eluser]
I know what the error means. I am just not understanding what I'm not doing to receive the error.
#4

[eluser]Aken[/eluser]
The error literally tells you what you're doing wrong. You're trying to use a variable that doesn't exist. You haven't defined a body anywhere...
#5

[eluser]xtremer360[/eluser]
I was hoping someone who has used the library before would know because I thought the build function says what the body view is supposed to be.
#6

[eluser]TheFuzzy0ne[/eluser]
I've not used the library before, but I *think* you need to make a call to $this->template->set_partial().

Code:
$this->template
             ->title('Login')
             ->set_layout('usermanagement')
             ->set_partial('body', 'location/of/partial_view')
             ->build('login');
#7

[eluser]xtremer360[/eluser]
The build is what takes care of the body in the documentation.
#8

[eluser]Aken[/eluser]
[quote author="xtremer360" date="1362499606"]The build is what takes care of the body in the documentation.[/quote]
No, build() just runs and generates everything that you've told it to generate. It doesn't create any variables for you.
#9

[eluser]xtremer360[/eluser]
I actually needed to add in this line for it to work. ->enable_parser(FALSE);




Theme © iAndrew 2016 - Forum software by © MyBB