Welcome Guest, Not a member yet? Register   Sign In
Handling partial loads from the controller
#1

[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)

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

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:

Code:
..
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:

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

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




Theme © iAndrew 2016 - Forum software by © MyBB