• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Handling partial loads from the controller

[eluser]Aria Rajasa[/eluser]
I am sorry if this question have been posted, but i've search regarding partials and have not succeeded in finding them, so here goes..

I have inclue a view under a view like this (in my view/layout/default.php)

<div id="topbarleft">
&lt;?= $this->load->view('elements/main_menu');?&gt;

And i would like it if i can enable and disable the loading of that 'elements' in the controller (like the Elements plugin in cakePHP). Maybe something like this in a controller:

function test_method() {
$this->loadElements(array('a', 'b', 'c');

With a, b, c as the name of the elements. And of course in the view, i can count it like in Joomla. maybe like this:

if($this->elements-count('a') > 0) {
//display something

Is there a good way to do it? Thank you so much for further help.

Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  

  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2020 MyBB Group.