nivoslidermanagement Nivo Slider Management for end users.

  1. NOTE:DEPRECATED
  2. Requirements
  3. Installation
  4. Resources

NOTE:DEPRECATED

You might want to check my GalleryManager extension first. I will never update this extension again.

This is a Management extension module for a typical jQuery slider,Nivo Slider.It makes possible for an end user to upload images,provide a caption and optionally a link to a page for each image of the slider.The module can easily be modified to manage any widget expecting an array of images as part of it's configuration.Plus,the management page could work very well as an image gallery.

Requirements

Tested with Yii 1.5,it will probably work with Yii 1.6 also.

Installation

  • Exctract download zip and copy nivoSliderManagement folder to modules folder of your Yii application.
  • Create a table in your database using the images_table.sql file found in data module folder.
  • Create the folder that images will be uploaded to, with a name of your choice, inside assets folder of your Yii application.In module configuration (see below) you will specify the name of the folder you just created as 'upload_directory'.
  • In config/main.php of your Yii application include nivoSliderManagement in modules array,like so:( The module is configured with default values.)
'modules'=>array(

    //...other modules...

'nivoSliderManagement'=>array(
               'columnLayout'=> '/layouts/column2',
               'upload_directory'=> 'up',
               'max_file_number'=> '10',
               'max_file_size'=> '1mb',
              ),

    //...other modules...
     );
  • Place the following code inside the view that you want Nivo Slider in, check Nivo Slider for Yii extension page for details on options.
$this->widget('application.modules.nivoSliderManagement.extensions.nivoslider.CNivoSlider', array(
     //nsprovider is  a variable sent  from the corresponding action,see below.
                       'images'=>$nsprovider,
                       'effect'=>'sliceUpDown',
                       'config'=>array(
		       'effect'=>'sliceUpDown',
		       'slices'=>25,
		       'animSpee'=>500,
		       'pauseTime'=>6000,
		       'startSlide'=>0,
		       'directionNav'=>true,
		       'directionNavHide'=>true,
		       'controlNav'=>true,
		       'keyboardNav'=>true,
		       'pauseOnHover'=>true,
		       'manualAdvance'=>false,
		       'captionOpacity'=>0.5,
          // 'controlNavThumbs'=>true,
         // 'controlNavThumbsSearch'=>'.jpg', //Replace this with...
        // 'controlNavThumbsReplace'=>'_100_100_thumb.jpg', //...this in thumb Image src
        // 'controlNavThumbsFromRel'=>true
			)
    )
);
  • Place the following code inside the action that renders the view file containing Nivo Slider.
Yii::import('application.modules.nivoSliderManagement.models.Img');
//get images from database
$ns_dataProvider = new CActiveDataProvider('Img', array(
  'criteria' => array(
      'select' => array('t.path', 't.title', 't.basename', 't.extension','t.url','t.file_id'),
      'order' => 'title'
                        ),
   'pagination'=>array(
                       'pageSize'=>50,
                       ),
                       ));

$ns_images = $ns_dataProvider->getData();

$nsprovider = array();
$baseurl = Yii::app()->baseUrl;
foreach ($ns_images as $image) {
                if ($image['url'] != "nolink") {
  $nsprovider[] = array('src' => $image['path'].'/'.$image['file_id'].$image['extension'],
                        'caption' => $image['title'],
                        'url' => $baseurl .'/'.$image['url'],
                        'imageOptions' => array('rel' => $image['path'] .'/tmb/'.   $image['file_id'] . '_100_100_thumb' . $image['extension'])
                                                 );
            } else {
  $nsprovider[] = array('src' => $image['path'] . '/' . $image['file_id'] . $image['extension'],
                        'caption' => $image['title'],
                        'imageOptions' => array('rel' => $image['path'] . '/tmb/' . $image['file_id'] . '_100_100_thumb' . $image['extension'])
                                                 );
                     }
                    };

	    $this->render('[VIEW CONTAINING NIVO SLIDER]',array('nsprovider'=>$nsprovider));
  • Last,optionally, for linking the images to content,install cmssitestructuremodule Yii extension:
    cmssitestructuremodule
    As an alternate option,you can easily adapt your module to your own CMS simply by modifying actionGetlinks action in PlController.

The URL for the management page will be [root folder of your Yii application]/nivoSliderManagement.

Resources

NOTE:With the exception of cmssitestructuremodule,you don't have to download and install these extensions,they are included in the module's extensions folder.

Cheers.

5 0
13 followers
3 314 downloads
Yii Version: 1.1
License: MIT
Category: User Interface
Developed by: drumaddict
Created on: Mar 24, 2011
Last updated: 12 years ago

Downloads

show all

Related Extensions