Welcome Guest, Not a member yet? Register   Sign In
Execute controller from view
#23

[eluser]Gilles_T[/eluser]
nuwanda,

I do the refresh the panel with an javascript reload, and that is clean (I guess). But for the initial display, I directly call the function in the controller that generates the HTML. This is where the view calls the controller.

To be more specific, I have a controller dashboard.php that contains the index function and a set of couple of functions panel_x_view and panel_x_get_view (meant to display the X panels) :

-> panel_x_view generates the html for the particular information panel ($d)
Code:
return $this->load->view('panel_x_view',$d,true);

-> index function calls the main view to which the html generated above is passed :

Code:
$this->load->view('dash_main_panel_view',array(
                                  'panel_x_html'  => $this->panel_x_view($data),
                                  'panel_y_html' => $this->panel_y_view($data),
                                  'panel_z_html'  => $this->panel_z_view($data),
                                  'panel_t_html'  => $this->panel_t_view($data)
                                                                  ));

-> panel_x_get_view is just a page wrapper that gets make a page header, calls the html of panel_x_view and make a footer

-> dashboard main window will call the panel_x_get_views the following way :

Code:
<?php if($panel_x_html != null):?>
            <!-- script type="text/javascript">
                var auto_refresh = setInterval(
                               function ()
                               {
                               $('#load_panel_x').load('<?=site_url()?>/dashboard/panel_x_get_view').fadeIn("slow");
                               }, <?=TBORD_REFRESH+80?>);  // 80 is different for each panel to avoid simultaneous calls
            <!-- /script>
            <div id="load_panel_x" class="dashboard_panel">&lt;?=$panel_x_html?&gt;</div>
        &lt;?php endif;?&gt;

The problem is, if I don't call the display, I have to wait until the page refresh...

The core question is : Is it technically risky to call a controller from a view ? May it generate some bad behavior at server level or at the user's session level ?

Regards


Messages In This Thread
Execute controller from view - by El Forum - 11-01-2007, 03:23 AM
Execute controller from view - by El Forum - 11-01-2007, 04:12 AM
Execute controller from view - by El Forum - 11-01-2007, 04:48 AM
Execute controller from view - by El Forum - 11-01-2007, 05:07 AM
Execute controller from view - by El Forum - 11-01-2007, 05:17 AM
Execute controller from view - by El Forum - 11-01-2007, 05:34 AM
Execute controller from view - by El Forum - 11-01-2007, 06:01 AM
Execute controller from view - by El Forum - 11-01-2007, 07:37 AM
Execute controller from view - by El Forum - 11-01-2007, 09:19 AM
Execute controller from view - by El Forum - 11-01-2007, 10:14 AM
Execute controller from view - by El Forum - 11-01-2007, 04:25 PM
Execute controller from view - by El Forum - 11-01-2007, 04:47 PM
Execute controller from view - by El Forum - 11-02-2007, 08:20 AM
Execute controller from view - by El Forum - 11-02-2007, 11:17 AM
Execute controller from view - by El Forum - 11-02-2007, 02:38 PM
Execute controller from view - by El Forum - 07-07-2009, 10:33 AM
Execute controller from view - by El Forum - 07-07-2009, 12:26 PM
Execute controller from view - by El Forum - 02-17-2010, 07:29 AM
Execute controller from view - by El Forum - 07-27-2011, 06:35 AM
Execute controller from view - by El Forum - 07-27-2011, 08:07 AM
Execute controller from view - by El Forum - 07-27-2011, 08:37 AM
Execute controller from view - by El Forum - 08-03-2011, 02:20 AM
Execute controller from view - by El Forum - 08-06-2011, 03:04 AM
Execute controller from view - by El Forum - 08-06-2011, 05:24 PM
Execute controller from view - by El Forum - 08-08-2011, 04:09 AM
Execute controller from view - by El Forum - 08-09-2011, 02:59 AM
Execute controller from view - by El Forum - 07-18-2012, 06:11 AM



Theme © iAndrew 2016 - Forum software by © MyBB