Yii 1.1: slider

Simply create a images slideshow

Simply create a images slideshow, using jQuery Cycle Plugin from www.jquery.malsup.com/cycle


Requirements (Yii 1.5 or above)


* Extract archive in your extensions folder
* In the site's root create a folder named "images" and copy content of "images" folder from archive


To include a slider in page:
<?php $this->widget('application.extensions.slider.slider');?>
     <?php $this->widget('ext.slider.slider');?>
If you wish to customize your slider, you can set options:
        $this->widget('ext.slider.slider', array(
            'alts'=>array('First description','Second description','Third description','Four description'),


sliderBase = string - set the folder base for slider, related to webapp root

imagesPath = string - set the folder for images used in active page

container = string - container class for slider

width = integer - the width of container

height = integer - the height of container

timeout = integer - speed to change images

infos = string - display the information over every picture

constrainImage = boolean - force the image to fill the container

images = array - set the name and the order of the pictures which will be displayied

alts = array - set alt attribute for every picture used in slider and definder in images attribute

urls = array - set url for every picture used in slider and definder in images parameter

defaultUrl = url - set the url where will be redirected at click on picture

defaultAlt = url - set default alt atribute to be used for all pictures used in slider

sameToAll = boolean - if is set to true, the set of images will be taken from "all"" folder from sliderBase folder and can be displayied in all pages (as a banner for example), if is set to false, you must create a folder named by page id, and slider will use that folder


Total 16 comments

#17455 report it
za_al at 2014/06/14 12:35pm
solution of didn't display image

Hi . tanks for good ext. I first install ext ,but it didn't work correctly . extension didn't display image . solution :I copied images folder to web root (where index.php exist)

#14801 report it
frazelli at 2013/09/10 01:19pm
Change effect

Hi. How can I change effects for this extension? There is fade and curtainY by default. I want to use the fade only. How can I do it? I have tried to change fx in slider.js but it didn't help me. Thanks.

#10090 report it
Touzas at 2012/10/04 03:19am
Changes to assign images from php

I need modify this extension to assign images from php: - First, i modified a EasySlider.php

public function run () {
        echo '<div id="slider-wrap" style="width: '.$this->width.'; height: '.$this->height.'"><div id="'.$this->id.'"><ul>';
        foreach ($this->data as $key => $value) {
        if (is_array($value)){
            foreach($value as $data){
                if (isset($data['url']) and $data['url'] != '') {
                    echo '<li><a href="'.$data['url'].'"><img src="'.$data['image'].'" alt="'.$data['title'].'"></a></li>';
                } else {
                    echo '<li><img src="'.$data['image'].'" alt="'.$data['title'].'"></li>';
  • Second, I created a widget
$items = Items::Model()->findAll()
if ($items){
    foreach($items as $data){
        $items[] = array(
            'title' => $data->title,
            'url' => Yii::app()->createUrl('items/'.$data->id),
            'image' => $data->imagen
$this->widget ('ext.EasySlider.EasySlider', array (
    'width' => '314px',
    'height' => '400px',
    'data' => array (
#9806 report it
haymps at 2012/09/11 04:55pm
Great Extension

You made my day! What can I do for you?

Thanks, Peter

#7248 report it
WebDevPT at 2012/03/06 07:42pm
It works

Hi again, I tested again with the help of the matricks and seems that this extension DOES WORK on a live server. (Yii 1.1.10)

I wasn't able to display the images on a local server running on WAMP with Windows environment. Perhaps there's something wrong my my settings.

#7243 report it
matricks at 2012/03/06 09:05am
To WebDevTP

Hi. Please contact me from Contact page at http://dios.binary-technology.ro/. I will help you to make it to work.

#7240 report it
WebDevPT at 2012/03/06 07:26am
Hi again

Hi, thank you for the fast reply.

I tested again and this is what i used

<?php $this->widget('application.extensions.slider.slider');?>
<?php $this->widget('ext.slider.slider');?>
        $this->widget('ext.slider.slider', array(
            'alts'=>array('First description','Second description','Third description','Four description'),

all 3 examples render me a grey rectangle, so i guess i'm not using the correct path for the images. I'm placing my images inside the folder with *

  • assets
  • css
  • images * (inside a folder named "slider" and 3 other folders that you mentioned)
  • protected
  • themes

i also tested to copy the images folder inside my protected dir.

What am i doing wrong, is there a parameter that i can use to tell where my pics are located? Thank you again for the quick update.

#7237 report it
matricks at 2012/03/06 06:27am
To WebDevTP

Hi. You have right about using <?php $this->widget('extensions.slider.slider');?>. Please replace this with <?php $this->widget('application.extensions.slider.slider');?> or with <?php $this->widget('ext.slider.slider');?>. I will change on this page to reflect correct way. Thank you.

I am sure that your problem is with the path to your images. Please check if you copied the folder images from extension zip, to your webroot. You must see a structure like: /images/slider/19; /images/slider/all; /images/slider/system;

#7234 report it
WebDevPT at 2012/03/06 05:09am
Can't use this properly.

Hi first of all, i'm kinda new to this framework, so sorry if my info is not accurate of if i lack the skills to use this type of extensions. I tested this and can't use it properly.

I see a grey rectangle with around 50px of height extended horizontally on my layout when i try to use this extension. What's missing here? perhaps the path to the images?

Can you provide me more instructions on how to use this or what i'm doing wrong about this. I put the images on the right place from your description.

By the way, when using this code:


there's an error. Anyone else experiencing this?

What am i doing wrong?

#6913 report it
matricks at 2012/02/13 05:59am

Thank you for negative vote. Thumb up for you.

Sorry because my extension is so simply to install and use and not need too much documentation. I wrote all do you need to use it. Or do you expect me to copy your technique? No. No. I will not upload a full yii app only to show you how to use this simple extension. Bye.

#6875 report it
ejac at 2012/02/10 12:35pm

Hi, can you please make it sure that your installation instructions will properly work else this will degrade quality and could possibly become trash.


#5815 report it
pengemizt at 2011/11/15 11:40pm
PHP Short Tag


<div class="<?=$this->container;?>"><?=$items;?></div>

and much in _item.php

#5269 report it
Justinas at 2011/09/28 08:27am

Problem is in slider.php line 163:

$url = $this->urls[$k] ? $this->urls[$k] : $this->defaultUrl;

change to

$url = isset($this->urls[$k]) ? $this->urls[$k] : $this->defaultUrl;

Problem is that urls is not set in your widget custom options and all using default options will face this issue.

#4983 report it
bonnie at 2011/09/03 11:04am
Undefined offset: 0

I have tried it but getting this error Undefined offset: 0. line slider\slider.php(163) On windows wamp

#4970 report it
matricks at 2011/09/02 02:57am

Indeed. I forgot to mention his credit, but I did it now. Thanks.

#4963 report it
jacmoe at 2011/09/01 04:25pm

Would probably be prudent to mention that this extension uses jQuery Slider from Malsup.com: Malsup Slider

Leave a comment

Please to leave your comment.

Create extension