Yii framework – call controller function from view


public function getLocations($id)
{
$ids= explode(“,”,$id);
foreach($ids as $key=>$val){
$ids[$key]=(int)$val;
}
$data = Yii::app()->db->createCommand()->select (‘GROUP_CONCAT(location_name) as locations’)->from(‘mt_location’)->where(array(‘in’,’mt_location_id’,$ids))->queryRow();
return $data[“locations”];

}

in view file

array(
‘name’=>’mt_location_id’,
‘value’=>’MtGetintouchController::getLocations($data->mt_location_id)’,
),

Change Background Image When Bootstrap carasoule change


Jquery
$(function(){
$(‘#myCarousel’).bind(‘slid’, function(e){ //This event is fired when the carousel has completed its slide transition.

index = $(‘#myCarousel .item’).index($(‘#myCarousel .carousel-inner .active’)); // find the index of current slide

$(‘.carousel-navbar .current’).removeClass(‘current’); // reset the navigation

$(‘.carousel-nav’).eq(index).addClass(‘current’); // update the navigation
$(“body”).attr(“style”,”background :url(‘images/”+($(‘#myCarousel .active’).attr(“slider_image”))+”‘) no-repeat scroll center top rgba(0, 0, 0, 0) !important”);
});

});

HTML Code


Chnage Image at here in above html code ======> slider_image=”image.jpg”

Reference Link : http://mohsinrasool.wordpress.com/2012/12/13/paging-carousel-using-twitter-bootstrap/