Welcome Guest, Not a member yet? Register   Sign In
Using Nested MVC for View partials (Updated)
#5

[eluser]wiredesignz[/eluser]
And finally an example of the users page controller. (application/controllers/admin/users.php)
Notice that the View isn't rendered to HTML but stored as an Object until we're ready to display it.
Code:
<?php if (!defined('BASEPATH')) exit('No direct script access allowed');

require_once(APPPATH.'controllers/admin/admin_controller.php');

class Users extends Admin_controller
{
    function Users()
    {
        parent::Admin_controller('users', 3); //set menu + access level
        $this->load->model('users_model', 'users');
    }
    
    function index()
    {        
        $this->users->findAll();
        
        $this->view->set(array(
            'title'       => 'Administration :: Users',
            'active_uid'  => $this->user->uid,
            'data_source' => &$this->users->resultset,
        ));
        
        $this->view->render();  // the page (HTML) is created and output from here.
    }
}


Messages In This Thread
Using Nested MVC for View partials (Updated) - by El Forum - 02-03-2008, 05:56 PM
Using Nested MVC for View partials (Updated) - by El Forum - 02-03-2008, 06:03 PM
Using Nested MVC for View partials (Updated) - by El Forum - 02-03-2008, 06:21 PM
Using Nested MVC for View partials (Updated) - by El Forum - 02-03-2008, 06:26 PM
Using Nested MVC for View partials (Updated) - by El Forum - 02-03-2008, 06:49 PM
Using Nested MVC for View partials (Updated) - by El Forum - 02-04-2008, 01:11 AM
Using Nested MVC for View partials (Updated) - by El Forum - 02-04-2008, 01:37 AM



Theme © iAndrew 2016 - Forum software by © MyBB