• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
using a single controller?

#5
[eluser]michaelp420[/eluser]
Ah ha! Thanks man...got it to work out. I kept running into a snag by just forwarding on any requests to a controller i named "master" (see below). I had to create at least one function within Master or it wouldn't work (placeholder):
Code:
<?php  if (!defined('BASEPATH')) exit('No direct script access allowed');

// This is important
require_once('template_engine.php');

class Master extends TemplateEngine {
    
    function Master()
    {
        parent::TemplateEngine();
        parent::set_section('pagetitle','| '.$this->Nav->section_title(), 'APPEND');
        
        if(count($this->uri->segment_array())<=1)
        {
            $pagefile = $this->uri->segment(1)."/index.inc";
        }
        else
        {
            $pagefile = $this->uri->segment(1)."/".$this->uri->segment(2).".inc";
        }
        
        parent::set_section('pagetitle', '| '.$this->Nav->page_title(), 'APPEND');
        
        //Set privacy view as main contents
        parent::set_section('content', $this->load->view($pagefile, '', true));
        
        //Load & pass sidebar to template engine
        $data['bottom_image'] = '/images/wm_develop.gif';
        parent::set_section('sidebar_left_bottom',$this->load->view('templates/layouts/sidebar_left_bottom_view', $data, true));
        
        //build the template
        parent::build_template();
    }
    
    function placeholder()
    {
        // this function is only here as placeholder so that
        // the redirected route has a place to go
    }
}
?&gt;

Then using my new route placed in the config/route.php file:

Code:
$route[':any'] = "master/placeholder";

All requests are rerouted to the master controller and from there i build the appropriate page.

Thanks for you help!!!

-Michael


Messages In This Thread
using a single controller? - by El Forum - 10-13-2007, 05:31 PM
using a single controller? - by El Forum - 10-14-2007, 03:19 AM
using a single controller? - by El Forum - 10-14-2007, 11:40 AM
using a single controller? - by El Forum - 10-14-2007, 12:04 PM
using a single controller? - by El Forum - 10-15-2007, 12:22 PM

Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2020 MyBB Group.