Monday, April 21, 2014

PYROCMS Module View Call from Helper

 Pyrocms:
We used pyrocms , in this each module contain plugin.php.
This file used for display the module views.
This plugin.php used $this->module_view function.

But we need to load  the other modules view files only option in plugin.php.
Not other option.


so i wrote this code for simply call the module view from any location.



Code : [put this code to helper file or create new helper file  in (system/cms/helpers/)]
require_once APPPATH.'libraries/Plugins.php';

class Display_mview extends Plugin
{

 public    function disp_module($module, $view, $vars = array(), $parse_output = true) {
       
        $ci =& get_instance();
        $mview = $this->module_view($module,$view, $vars , $parse_output);
        return $mview ;
    }

}


 function module_view($module, $view, $vars = array(), $parse_output = true)
{
    $dview = new Display_mview();
    $module_view = $dview->disp_module($module,$view, $vars , $parse_output);   
    return $module_view;
}





Ex : [call any view or any controller or any where]

 call from anywhere and any module.

<?php echo module_view('module_name','view name',array('data'=>'value')); ?>


No comments:

Post a Comment