Ajax banner rotation script

Hi there,

Does anyone have an ajax script for yii that would auto load an image url which was stored in the db every x seconds?

Im guessing this is pretty easy to do… please help!

You could use something like this to call a javascript function on interval:




Yii::app()->clientScript->registerScript('headerImgScript', "


headerScrollInt = setInterval(nextHeaderImg,10000);


", CClientScript::POS_LOAD);


 ?>



Then put your javascript into


function nextHeaderImg(){}

How you do that will depend on whether you preload the images or you want to just populate it via ajax each time.

Thanks, I ended up just integrating a third party admanager system called admanagerpro… cheers!