Welcome Guest, Not a member yet? Register   Sign In
IS IT POSSIBLE?
#1

[eluser]Bhushan[/eluser]
HI ALL,
i have one view file with two <div> tags and one controller file.
from controller's index function i want to call only first <div> tag and next <div> is from another function.

Is It possible??
#2

[eluser]richzilla[/eluser]
Im assuming you want to affect the value of two different divs in the same view with two separate functions. yes. Send the HTML you wish to display as a string in your controller, with each function sending each string of html:

Code:
function one()
{

$data['my_html_1'] = $my_html_1;
$this->load->view('my_view',$data);

}

function two()
{

$data['my_html_2'] = $my_html_2;
$this->load->view('my_view',$data);

}

then in your view:

Code:
&lt;?php if($my_html_1) : ?&gt;
<div id="one">

&lt;?php echo $my_html_1; ?&gt;

</div>

&lt;?php endif; ?&gt;

&lt;?php if($my_html_2) : ?&gt;
<div id="two">

&lt;?php echo $my_html_2; ?&gt;
</div>

&lt;?php endif; ?&gt;

but i have to ask, why not just use two different views?
#3

[eluser]Bhushan[/eluser]
THANKS!!!!!!!!!!!!!!
It was task for me.
i m new to codeigniter.




Theme © iAndrew 2016 - Forum software by © MyBB