Welcome Guest, Not a member yet? Register   Sign In
[Solved] Custom Folder Structures
#1

[eluser]Anraiki[/eluser]
Prior to this topic, I was attempting to make a custom structure that divides Code Igniter into separate parts.

One for designer and the other is for developers.

The root folder consisted:

- index.php
- /application/
-- (code igniter stuff in the application folder)
- /template/


The application folder is the core of code igniter, while the template folder held the design part of code igniter.

Although we have the view files, I wanted to make the template folder in the top level of the ground without digging to deep from the root.

I was only half way successful in loading the files in the template folder but there was a problem: The inclusion of the objects in this folder did not inherit any variables or functions; it had its own scope.

In my controller file I have:
Code:
class Front extends Controller {

    function Front()
    {
        parent::Controller();    
    }
    
    function index()
    {

        $this->load->library('template');
        $this->template->load('index.php');

    }
}

In my template class:
Code:
class Template extends Controller {
    
    function load($object)
    {
        include('template/default/'.$object);
    }
    
    function get_header()
    {
        include('template/default/header.php');
    }
    
    function get_footer()
    {
        include('template/default/footer.php');
    }
    
}

Everything above works just fine however:

In my template's index file:
Code:
<?php $this->template->load('header.php'); ?>

<div id="content">
    <p>The page you are looking at is being generated dynamically by CodeIgniter.</p>
</div>

&lt;?php $this->template->get_footer(); ?&gt;

The 1st line:
Code:
&lt;?php $this->template->load('header.php'); ?&gt;
Is called to a undefine object.

The simple question is: Does anyone know how to pass the helpers, libraries, variables, or functions into these included files?

Your help may revolutionized the way Code Igniter is used for development.

Thank you Smile


Messages In This Thread
[Solved] Custom Folder Structures - by El Forum - 02-07-2009, 05:24 PM
[Solved] Custom Folder Structures - by El Forum - 02-08-2009, 12:54 PM
[Solved] Custom Folder Structures - by El Forum - 02-08-2009, 08:39 PM
[Solved] Custom Folder Structures - by El Forum - 02-09-2009, 06:06 AM



Theme © iAndrew 2016 - Forum software by © MyBB