Advanced module functionality in front controller?

edited January 2012 in Modules
I think I've managed to build out an adv module (/fuel/modules/store) with a store_catalog_model (store/models/store_catalog_model) and a view (store/views/catalog.php). But when I navigate to the page, http://store.local/store/catalog, I just get my var_dump of data, which works, but it's sans any of the other view code/files. I'm trying to basically be able to output my catalog from any front end controller view.

Is this a routing issue? I'm missing something fundamental, me thinks.

Thanks a lot!

Comments

  • edited 9:42PM
    Couple questions:

    1. Do the view files live in the store module (e.g. fuel/modules/store/views/my_view.php) or your application directory (fuel/application/views/my_view.php)?
    2. Are you using $this->load->view('store/my_view', $vars) or $this->load->module_view('store', 'my_view', $vars)
  • edited 9:42PM
    They live in the module (store/views/catalog.php).

    In the catalog.php controller (fuel/modules/store/controllers/catalog.php) i'm using: $this->load->module_view(STORE_FOLDER, 'catalog', $vars);
  • edited January 2012
    Progress:

    I'm able to get the catalog into the now "shop" controller/view in the application:

    function index()
    {
    $this->load->library('store/fuel_store');
    $vars['catalog'] = $this->fuel_store->get_catalog();

    $page_init = array('location' => 'shop');
    $this->load->module_library(FUEL_FOLDER, 'fuel_page', $page_init);
    $this->fuel_page->add_variables($vars);
    $this->fuel_page->render();
    }

    I think what I was missing was instantiating the 'fuel_store' lib rather than the module itself, which is where I was confused. Now i'm hoping to load the module view(s) into the application view somehow. Something to do w/ load->module_view in the application controller?
  • edited 9:42PM
    You can use the module name 'app' to reference the application folder:
    $this->load->module_view('app', 'my_view', $vars);
Sign In or Register to comment.