ExpressionEngine CMS
Open, Free, Amazing

Thread

This is an archived forum and the content is probably no longer relevant, but is provided here for posterity.

The active forums are here.

hmvc partial views

April 16, 2011 5:41pm

Subscribe [2]
  • #1 / Apr 16, 2011 5:41pm

    RJ

    179 posts

    I have a dashboard that contains several partials, the only way I found to load these partials in the controller is:

    The display controller:

    private function _dashboard()
            {
                    $glimpse = $this->load->module('glimpse');
                    
                    $this->template
                            ->set('glimpse', $glimpse->load())
                            ->build('dashboard');
            }

    Then in glimpse I have:

    function load()
        {                
            return $this->load->view('g_profile', true);
        }

    I have to do the same thing to display a simple login box, but I don’t like having to setup a separate method in the module controller to return these views.  I also don’t want to do Modules::run() in the view (logic should be in controller imho). 

    What method do you use to load partial views from one module to the next?

  • #2 / Jul 17, 2011 9:56pm

    seanloving

    120 posts

    I think you can call modules::run directly from your controller like this (untested):

    private function _dashboard()
            {
                    $glimpse = $this->load->module('glimpse');
                    $load = modules::run('glimpse/load');
                    
                    $this->template
                            ->set('glimpse', $load)
                            ->build('dashboard');
            }

    -seanloving

  • #3 / Jul 17, 2011 10:20pm

    RJ

    179 posts

    I’ll give it a whirl.  Thank you for commenting on this old post 😊

.(JavaScript must be enabled to view this email address)

ExpressionEngine News!

#eecms, #events, #releases