WebsiteBaker Logo
  • *
  • Templates
  • Help
  • Add-ons
  • Download
  • Home
*
Welcome, Guest. Please login or register.

Login with username, password and session length
 

News


WebsiteBaker 2.13.6 is now available!


Will it continue with WB? It goes on! | Geht es mit WB weiter? Es geht weiter!
https://forum.websitebaker.org/index.php/topic,32340.msg226702.html#msg226702


The forum email address board@websitebaker.org is working again
https://forum.websitebaker.org/index.php/topic,32358.0.html


R.I.P Dietmar (luisehahne) and thank you for all your valuable work for WB
https://forum.websitebaker.org/index.php/topic,32355.0.html


* Support WebsiteBaker

Your donations will help to:

  • Pay for our dedicated server
  • Pay for domain registration
  • and much more!

You can donate by clicking on the button below.


  • Home
  • Help
  • Search
  • Login
  • Register

  • WebsiteBaker Community Forum »
  • WebsiteBaker Support (2.8.x) »
  • Droplets & Snippets »
  • New Droplet - P-Gallery
  • Print
Pages: [1]   Go Down

Author Topic: New Droplet - P-Gallery  (Read 16666 times)

Offline crnogorac081

  • Posts: 2161
  • Gender: Male
New Droplet - P-Gallery
« on: October 22, 2009, 01:18:20 PM »
Hi,

I modified Pikachoose JQuery Gallery to be a droplet for WB.

You must download the attachemnt and upload files to ROOT/include/jquery/plugins/pikachoose  folder.

Then create New droplet:

Code: (P-Gallery) [Select]
$wb_page_data = str_replace('</head>','<!-- P-Gallery -->'."\n".'<link href="'.WB_URL.'/include/jquery/plugins/pikachoose/pikachoose.css" rel="stylesheet" type="text/css"/>'."\n".'<script src="'.WB_URL.'/include/jquery/plugins/pikachoose/pikachoose-min.js" type="text/javascript"></script>'."\n".'<script src="'.WB_URL.'/include/jquery/plugins/pikachoose/pikachoose-set.js" type="text/javascript"></script>'."\n".'</head>', $wb_page_data );

$folder=opendir(WB_PATH.MEDIA_DIRECTORY.'/'.$dir.'/.');
$names = array();
while ($file = readdir($folder))  {
    $ext=strtolower(substr($file,-4));
    if ($ext==".jpg"||$ext==".gif"||$ext==".png"){
        $names[count($names)] = $file;
    }
}
closedir($folder);
reset(shuffle($names));
array_unshift($names," ");
if(isset($width)){$width=' width="'.$width.'"';}else{$width="";}
if(isset($height)){$height=' height="'.$height.'"';}else{$height="";}
$count=1;

while(($image=next($names))and(($count<=$num)or(!isset($num)))){

if( $count ==1){$class=' class="active"';}else{$class='';}

$name=substr($image,0,-4);
if($link=="y"){$images=$images.'<a href="'.WB_URL.MEDIA_DIRECTORY.'/'.$dir.'/'.$image.'" target=_blank>';}
if(file_exists(WB_PATH.MEDIA_DIRECTORY.'/'.$dir.'/thumbs/'.$image.'.thumb.jpg')){
$images=$images.'<img src="'.WB_URL.MEDIA_DIRECTORY.'/'.$dir.'/thumbs/'.$image.'.thumb.jpg" alt="'.$name.'" '.$width.$height.'/>';
}else{
$images=$images.' <li><img src="'.WB_URL.MEDIA_DIRECTORY.'/'.$dir.'/'.$image.'" alt="'.$name.'" '.$width.$height.$class.' /></li>';
}
if($link=="y"){$images=$images.'</a>';}
$count++;
}

return '<div class="pikachoose"><ul id="pikame">'.$images.'</ul></div>';


Droplet example:
[[P-Gallery?dir=folder_in_media/or_subfolder]]

You can restyle dimesions with csse.

You must include JQuery script into your header (included in WB 2.8), just copy this line into your header:

<script type="text/javascript" src="<?php echo WB_URL; ?>/include/jquery/jquery-min.js"></script>


Temporary demo link can be found here.

Original source files for this Gallery can be found here.

All best,
I

[gelöscht durch Administrator]
« Last Edit: January 27, 2010, 05:15:46 PM by crnogorac081 »
Logged
Web developer

saiborg

  • Guest
Re: New Droplet - P-Gallery
« Reply #1 on: October 23, 2009, 11:44:29 AM »
Hi, nice droplet....

but... i got an errormessage, can you help me please?!

Errormessage:
Code: [Select]
Warning: reset(): Passed variable is not an array or object in /srv/www/vhosts/microott.de/httpdocs/modules/droplets/droplets.php(41) : eval()'d code on line 11 Notice: Undefined variable: num in /srv/www/vhosts/microott.de/httpdocs/modules/droplets/droplets.php(41) : eval()'d code on line 16

Thank you Dirk
Logged

Offline crnogorac081

  • Posts: 2161
  • Gender: Male
Re: New Droplet - P-Gallery
« Reply #2 on: October 23, 2009, 11:52:27 AM »
Upss,

sorry, I forgot to write that you need to insert JQuery script to your header:

Insert this line into your templates index.php header:

<script type="text/javascript" src="<?php echo WB_URL; ?>/include/jquery/jquery-min.js"></script>

JQuery is allways part of my header now :)

cheers
« Last Edit: October 23, 2009, 11:54:55 AM by crnogorac081 »
Logged
Web developer

saiborg

  • Guest
Re: New Droplet - P-Gallery
« Reply #3 on: October 23, 2009, 12:00:56 PM »
Thanks for your fast answer.....but the errormessage still exists

I Put the Code in the Index.php....like this
Code: [Select]
<script type="text/javascript" src="<?php echo WB_URL; ?>/include/jquery/jquery-min.js"></script>
</head>
<body>

<script type="text/javascript">
var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www.");
Thanks Dirk
Logged

Offline crnogorac081

  • Posts: 2161
  • Gender: Male
Re: New Droplet - P-Gallery
« Reply #4 on: October 23, 2009, 12:02:12 PM »
wierd,

which version of WB do you use ?

Could you post a link (or PM me) to see whats wrong.. ?

cheers
Logged
Web developer

WebBird

  • Guest
Re: New Droplet - P-Gallery
« Reply #5 on: October 23, 2009, 12:05:48 PM »
$num is not defined before first usage.

Quote
while(($image=next($names))and(($count<=$num)or(!isset($num)))){

You can predefine it like this before the line above:

Quote
$num = NULL;

Or you may put it the other way around:

Quote
while((!isset($num)or($image=next($names))and(($count<=$num)))){

Edit: Anyway, using a var for while that's not set should be treated as a bug. ;)
« Last Edit: October 23, 2009, 12:07:44 PM by WebBird »
Logged

Offline maverik

  • Posts: 1572
  • Gender: Male
  • ..:: viva los tioz ::..
Re: New Droplet - P-Gallery
« Reply #6 on: October 23, 2009, 12:13:05 PM »
works out of the box only with some changes in css file, nice droplet  :-D

http://template.developer-base.de/pages/start/pikachoose.php
Logged

Offline crnogorac081

  • Posts: 2161
  • Gender: Male
Re: New Droplet - P-Gallery
« Reply #7 on: October 23, 2009, 12:23:04 PM »
there is a pikachoose-set.js -- settings file where you can adjust settings

cheers

BTW, I just copied that part of code from another droplet..  :-D
Logged
Web developer

Offline maverik

  • Posts: 1572
  • Gender: Male
  • ..:: viva los tioz ::..
Re: New Droplet - P-Gallery
« Reply #8 on: October 23, 2009, 12:35:24 PM »
options

http://pikachoose.com/versions/

i have only this in my pikachoose-set.js

Code: [Select]
   $(document).ready(
                function (){
                    $("#pikame").PikaChoose({   auto_play:false,
                                                                    slide_enabled:true,
                                                                    show_prev_next:false,
                                                                    show_captions:false,
                                                                    delay_caption:false,
                                                                    user_thumbs:false

                                                            });
                });
               
Logged

Offline crnogorac081

  • Posts: 2161
  • Gender: Male
Re: New Droplet - P-Gallery
« Reply #9 on: October 23, 2009, 12:38:45 PM »
That is the settings code, and I copied that code into one SETtings file :)
Logged
Web developer

saiborg

  • Guest
Re: New Droplet - P-Gallery
« Reply #10 on: October 23, 2009, 12:44:26 PM »
Hi,

im using WB2.8

an here ist the link:
http://www.microott.de/pages/administrators.php

Thanks Dirk
Logged

Offline maverik

  • Posts: 1572
  • Gender: Male
  • ..:: viva los tioz ::..
Re: New Droplet - P-Gallery
« Reply #11 on: October 23, 2009, 12:46:54 PM »
problem english language  :-D

your settings file

Code: [Select]
$(document).ready(
                function (){
                    $("#pikame").PikaChoose({auto_play:true, slide_enabled:false, show_prev_next:false});
                });
               
            $(document).ready(
                function (){
                    $("#pikame_user").PikaChoose({user_thumbs:true, show_prev_next:false});
            });
           
            $(document).ready(
                function (){
                    $("#pikame_compact").PikaChoose({user_thumbs:true, show_prev_next:false});
            });

i only want to say thats enough for me and works with the short code  :-)
Logged

Offline crnogorac081

  • Posts: 2161
  • Gender: Male
Re: New Droplet - P-Gallery
« Reply #12 on: October 23, 2009, 12:53:13 PM »
@maverik

Cool, I didnt clean the unneccessary code :)

@saiborg

Did you update droplet module to the one for WB, maybe you have multiple droplets or something..

Did you upload the files attached in first post ??

cheers
Logged
Web developer

saiborg

  • Guest
Re: New Droplet - P-Gallery
« Reply #13 on: October 23, 2009, 01:02:03 PM »
jep i did the upload, and put full permission to the folder and the files.
And i updated the droplets module for WB2.8

Dirk
Logged

Offline maverik

  • Posts: 1572
  • Gender: Male
  • ..:: viva los tioz ::..
Re: New Droplet - P-Gallery
« Reply #14 on: October 23, 2009, 01:03:13 PM »
@saiborg

Quote
<script src="http://www.microott.de/modules/jquery/jquery-min.js" type="text/javascript"></script>
<script src="http://www.microott.de/modules/jquery/jquery-ui-min.js" type="text/javascript"></script>
<script src="http://www.microott.de/modules/jquery/jquery-insert.js" type="text/javascript"></script>
<script src="http://www.microott.de/modules/jquery/jquery_api.js" type="text/javascript"></script>
<script src="http://www.microott.de/templates/microott_random/jquery_frontend.js" type="text/javascript"></script>
<script src="http://www.microott.de/modules/wysiwyg_query/frontend.js" type="text/javascript"></script><script src="http://www.microott.de/modules/droplets/js/mdcr.js" type="text/javascript"></script>
<script type="text/javascript" src="http://www.microott.de/include/jquery/jquery-min.js"></script>

you load min.js two times
Logged

saiborg

  • Guest
Re: New Droplet - P-Gallery
« Reply #15 on: October 23, 2009, 01:06:18 PM »
Thak you, i fixed it. But the error still exists.

Dirk
Logged

Offline crnogorac081

  • Posts: 2161
  • Gender: Male
Re: New Droplet - P-Gallery
« Reply #16 on: October 23, 2009, 01:12:50 PM »
hm, wierd.. I am not a coder so I cant help you much..:(

Maybe there is a problem because you have so many java scripts..

maybe some coder can help ?
Logged
Web developer

WebBird

  • Guest
Re: New Droplet - P-Gallery
« Reply #17 on: October 23, 2009, 04:06:03 PM »
Quote from: crnogorac081 on October 23, 2009, 12:23:04 PM
BTW, I just copied that part of code from another droplet..  :-D

Maybe you missed the $num-define-part of that droplet. :-D
Logged

WebBird

  • Guest
Re: New Droplet - P-Gallery
« Reply #18 on: October 23, 2009, 04:10:17 PM »
There are some more undefined vars causing that errors ($link, for example). You should always develop with PHP error option set to E_ALL. (I think saiborg has.)
Logged

Offline crnogorac081

  • Posts: 2161
  • Gender: Male
Re: New Droplet - P-Gallery
« Reply #19 on: January 27, 2010, 05:19:45 PM »
Hi,

Shall I post this droplet to AMASP ?
Logged
Web developer

WebBird

  • Guest
Re: New Droplet - P-Gallery
« Reply #20 on: January 27, 2010, 05:23:35 PM »
If it's fixed (throws no errors) und works nicely, why not? :-D
Logged

Offline crnogorac081

  • Posts: 2161
  • Gender: Male
Re: New Droplet - P-Gallery
« Reply #21 on: January 27, 2010, 05:26:00 PM »
The demo is available and I turned error report to All and saw no errors.. Could someone create me a page in droplets menu in AMASP page ?
Logged
Web developer

WebBird

  • Guest
Re: New Droplet - P-Gallery
« Reply #22 on: January 27, 2010, 05:27:23 PM »
There's a form somewhere to pass droplets.

Edit: http://www.websitebakers.com/pages/droplets/submit-droplet.php
Logged

  • Print
Pages: [1]   Go Up
  • WebsiteBaker Community Forum »
  • WebsiteBaker Support (2.8.x) »
  • Droplets & Snippets »
  • New Droplet - P-Gallery
 

  • SMF 2.0.19 | SMF © 2017, Simple Machines
  • XHTML
  • RSS
  • WAP2