Welcome Guest, Not a member yet? Register   Sign In
ME HMVC + custom library + fetch_module() does not work right
#6

[eluser]jtrainaldi[/eluser]
I came up with a solution and I don't know if it is the best way to go about but it seems to work for me.

In my modules I have the a similar setup through all the controller classes so if I need to create another controller class I can simple copy the file and change the name.


/module/config.php
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');

$config['module_name'] = 'tmp_mod';

---

class Tcontroller extends MX_Controller {

/**
* Name: recordlist function
* Desc: This function loads the database records in a table
*/
public function recordlist(){

//Declare and initialize variables
$data['filter'] = $this->uri->uri_to_assoc(4);
$data['content'] = $this->config->item('module_name') . '/' . $this->router->fetch_class() . '/recordlist';

//Load the view
$this->load->view('templates/fluid', $data);
}


--


This allows me to call any module within a module and I will be guaranteed to always get the correct view files.

If there is a better way to go about this or I am missing something let me know.

P.S. on a side note is there a way for my module controllers to extend a main controller in that module. Basically I would like set up permission checks on each module and I thought having a class Main extends MX_Controller and have all the other classes extend that module.

For example class Tcontroller extends Main { }


Messages In This Thread
ME HMVC + custom library + fetch_module() does not work right - by El Forum - 05-09-2012, 09:15 AM



Theme © iAndrew 2016 - Forum software by © MyBB