Kris-B / nanoSLIDER4GS

nanoSLIDER plugin for GetSimple CMS
5 stars 1 forks source link

whole folder functionality #20

Open danhauck opened 7 years ago

danhauck commented 7 years ago

I like your port of nivo slider and needed the functionality to have the whole Folder as an Album. Therefore I added some hack to your php.

Usage with a complete image folder

To display a slider, insert a code like this one in a GetSimple page :

  (%nanoslider kind=url&listImagesBaseURL=relativeBaseUrl&listImages=all%)

Replace:

Note: syntax is case sensitive.

Example:

  (%nanoslider
    kind=url
    &listImagesBaseURL=data/uploads/gallery/gallery1/
    &listImages=*
  %)

In nanoslider.php method jsParams I changed within the "URL" case the following within if( !empty($this->_listImages) ):

                if($this->_listImages == "*")
                {
                    if( !empty($this->_listImagesBaseURL) )
                    {
                        if(!is_Dir($this->_listImagesBaseURL))nanoSlider_debug($this->_listImagesBaseURL." is NOT dir (use of URLs doesnt work you have to use relative path from here: ".getcwd().")");
                        $filelist = scandir($this->_listImagesBaseURL);
                        foreach ($filelist as $key => $link) {
                            if(is_dir($dir.$link)){
                                unset($filelist[$key]);
                            }
                        }
                        if(count($filelist)==0)nanoSlider_debug($this->_listImagesBaseURL." has no files in");
                    $s.="'listImages':'".join("|",$filelist)."',"; 
                    //nanoSlider_debug("all files in folder '".$this->_listImagesBaseURL."': ".join("|",$filelist)); 
                    }
                }
                else
                {
                    $s.="'listImages':'".$this->_listImages."',"; 
                }