Reputation: 96
I am trying to create a modal window that will open under some conditions. I did create a modal window that is opening on button click. What should i change?
My view:
<button type="button" data-toggle="modal" data-target="#popupModal">open</button>
<div id="popupModal"
class="modal hide fade"
tabindex="-1"
role="dialog"
aria-labelledby="popupModalLabel"
aria-hidden="true">
...some html
</div>
</div>
my controller:
if (some conditions)
{
//here i want to open my modal window somehow
}
Upvotes: 0
Views: 48
Reputation: 139
From your controller Send your option in data array when you load your view. for example, your code should be Something like this..
Controller:
$data = array();
if (some conditions)
{
$data['option1'] = 'modal1';
}
else{
$data['option2'] = 'modal2';
}
$this->load->view('your view file', $data);
View:
if($option1){
// modal 1 html
}
else{
// modal 2 html
}
Try this. i hope you get an idea.
Upvotes: 0