Reputation: 81
code in the view page
href="#" class="popup">Vehicle Details
js file for popup (http://preview.hertzci.com/js/core.js)
var popups = function(){
$$('a.popup').each(function(el){
el.addEvent('click', function(e){
var href = el.href.toString();
href += href.contains("?") ? '&ajax' : '?ajax';
if ($('popup')){
$('popup').destroy();
}
var popup = new Element('div', {'id': 'popup'});
var popupInner = new Element('div', {'id': 'popupInner'}).inject(popup);
var closeBtn = new Element('a', {'id': 'closeBtn', 'style': 'cursor: pointer'}).inject(popup, 'top');
var myFx = new Fx.Morph(popup, {'duration': 600});
if (el.rel){
rel = el.rel.toString();
xPos = rel.split(",")[0];
yPos = rel.split(",")[1];
myFx.set({'left': xPos, 'top': yPos});
}
myFx.set({'opacity': 0});
closeBtn.addEvent('click', function(e){
myFx.start({'opacity': 0});
var e = new Event(e).stop();
});
popup.inject(el.getParent());
// Fetch popup content
var req = new Request.HTML({
method: 'get',
url: href,
data: {},
update: $('popupInner'),
onComplete: function(response) {
myFx.start({'opacity': 1});
}
}).send();
var e = new Event(e).stop();
});
});
}
i have to view the content of "popupVehicle.php" in popup how can i?
Upvotes: 0
Views: 7805
Reputation: 26941
One possible approach:
In your controller file (note TRUE
, it's the key of the approach):
$content = array();
$content['popup_content'] = $this->load->view('popupVehicle',array(), TRUE);
$this->load->view(*your view*, $content);
In your view file:
<script type='text/javascript'>
/*Place your popup-showing logic here
you need to show $('#popup') element*/
</script>
<div id='popup'><? echo $popup_content?></div>
The idea behind this is to load view's content into a variable, pass this variable to other view and display it in your popup element.
Upvotes: 1