bootstrap.widgets.TbCarousel

Hi All,

I’m sure this question has been asked a thousand times, but I’d really appreciate a small amount of help!

I’m trying to add images to bootstrap.widgets.TbCarousel from my DB, but can’t use ‘dataProvider’.

I’m a newbie but would really appreciate an example or some pointers?!

Kind regards

D

$items = [];

// get all images for rendering carousel

$images = YourTable::model()->findAll([‘condition’=>‘add search condition’]);

// populate items array

foreach ($images as $image) {

$items[] = [


      'image' => $image->pathToImage,


      'url' => $banner->someLinkIfNeeded,


      'itemOptions' => [htmlOptions for image]


       ];

}

// render widget

        $this->widget('bootstrap.widgets.TbCarousel', array(


            'items' => $items,


            'displayPrevAndNext' => false


        ));

hope this is helpful