Welcome Guest, Not a member yet? Register   Sign In
Load views in Controller or Model?
#5

[eluser]Pert[/eluser]
[quote author="jairoh_" date="1369545456"]the propery way is in the controller, models are designed for the backend databases' queries and etc. Smile[/quote]

Sure, but you could also cut out some of manual work loading views and choosing what view to show, specially when you have to load the same views in multiple controllers and/or methods.

Code:
$shopping_cart->draw('mini-cart');

just seems slightly more elegant than

Code:
if ($user->type === 'VIP')
   $view_file = 'shopping-cart/vip-mini-cart';
else
   $view_file = 'shopping-cart/mini-cart';
$this->load->view($view_file, array('shopping_cart' => $shopping_cart));


Messages In This Thread
Load views in Controller or Model? - by El Forum - 05-23-2013, 10:57 PM
Load views in Controller or Model? - by El Forum - 05-24-2013, 12:58 AM
Load views in Controller or Model? - by El Forum - 05-24-2013, 01:19 AM
Load views in Controller or Model? - by El Forum - 05-25-2013, 10:17 PM
Load views in Controller or Model? - by El Forum - 05-29-2013, 01:44 AM



Theme © iAndrew 2016 - Forum software by © MyBB