Welcome, Guest. Please login or register.
Did you miss your activation email?
May 26, 2012, 01:20:50 AM

Login with username, password and session length
Search:     Advanced search
Interested in joining the WebsiteBaker team?
For more Information read here or on our new website.
155533 Posts in 21713 Topics by 7738 Members
Latest Member: Pattieardathfe
* Home Help Search Login Register
Pages: [1]   Go Down
Print
Author Topic: New Droplet - P-Gallery  (Read 1953 times)
crnogorac081
AddOn Development
*
Offline Offline

Posts: 1706



« on: October 22, 2009, 12: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)
$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.Cool, 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
« Last Edit: January 27, 2010, 05:15:46 PM by crnogorac081 » Logged

Wow, I coded something myself: PM Messanger Modul ,Searchbox with suggestions
saiborg

Offline Offline

Posts: 101


WWW
« Reply #1 on: October 23, 2009, 10:44:29 AM »

Hi, nice droplet....

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

Errormessage:
Code:
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

schaut doch mal vorbei

http://www.microott.de
crnogorac081
AddOn Development
*
Offline Offline

Posts: 1706



« Reply #2 on: October 23, 2009, 10: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 Smiley

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

Wow, I coded something myself: PM Messanger Modul ,Searchbox with suggestions
saiborg

Offline Offline

Posts: 101


WWW
« Reply #3 on: October 23, 2009, 11:00:56 AM »

Thanks for your fast answer.....but the errormessage still exists

I Put the Code in the Index.php....like this
Code:
<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

schaut doch mal vorbei

http://www.microott.de
crnogorac081
AddOn Development
*
Offline Offline

Posts: 1706



« Reply #4 on: October 23, 2009, 11:02:12 AM »

wierd,

which version of WB do you use ?

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

cheers
Logged

Wow, I coded something myself: PM Messanger Modul ,Searchbox with suggestions
WebBird
Guest
« Reply #5 on: October 23, 2009, 11:05:48 AM »

$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. Wink
« Last Edit: October 23, 2009, 11:07:44 AM by WebBird » Logged
maverik

Offline Offline

Posts: 1568



WWW
« Reply #6 on: October 23, 2009, 11:13:05 AM »

works out of the box only with some changes in css file, nice droplet  grin

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

Signatur wird geladen...
crnogorac081
AddOn Development
*
Offline Offline

Posts: 1706



« Reply #7 on: October 23, 2009, 11:23:04 AM »

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..  grin
Logged

Wow, I coded something myself: PM Messanger Modul ,Searchbox with suggestions
maverik

Offline Offline

Posts: 1568



WWW
« Reply #8 on: October 23, 2009, 11:35:24 AM »

options

http://pikachoose.com/versions/

i have only this in my pikachoose-set.js

Code:
   $(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

Signatur wird geladen...
crnogorac081
AddOn Development
*
Offline Offline

Posts: 1706



« Reply #9 on: October 23, 2009, 11:38:45 AM »

That is the settings code, and I copied that code into one SETtings file Smiley
Logged

Wow, I coded something myself: PM Messanger Modul ,Searchbox with suggestions
saiborg

Offline Offline

Posts: 101


WWW
« Reply #10 on: October 23, 2009, 11:44:26 AM »

Hi,

im using WB2.8

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

Thanks Dirk
Logged

schaut doch mal vorbei

http://www.microott.de
maverik

Offline Offline

Posts: 1568



WWW
« Reply #11 on: October 23, 2009, 11:46:54 AM »

problem english language  grin

your settings file

Code:
$(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  smiley
Logged

Signatur wird geladen...
crnogorac081
AddOn Development
*
Offline Offline

Posts: 1706



« Reply #12 on: October 23, 2009, 11:53:13 AM »

@maverik

Cool, I didnt clean the unneccessary code Smiley

@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

Wow, I coded something myself: PM Messanger Modul ,Searchbox with suggestions
saiborg

Offline Offline

Posts: 101


WWW
« Reply #13 on: October 23, 2009, 12: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

schaut doch mal vorbei

http://www.microott.de
maverik

Offline Offline

Posts: 1568



WWW
« Reply #14 on: October 23, 2009, 12: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

Signatur wird geladen...
saiborg

Offline Offline

Posts: 101


WWW
« Reply #15 on: October 23, 2009, 12:06:18 PM »

Thak you, i fixed it. But the error still exists.

Dirk
Logged

schaut doch mal vorbei

http://www.microott.de
crnogorac081
AddOn Development
*
Offline Offline

Posts: 1706



« Reply #16 on: October 23, 2009, 12:12:50 PM »

hm, wierd.. I am not a coder so I cant help you much..Sad

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

maybe some coder can help ?
Logged

Wow, I coded something myself: PM Messanger Modul ,Searchbox with suggestions
WebBird
Guest
« Reply #17 on: October 23, 2009, 03:06:03 PM »

BTW, I just copied that part of code from another droplet..  grin

Maybe you missed the $num-define-part of that droplet. grin
Logged
WebBird
Guest
« Reply #18 on: October 23, 2009, 03: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
crnogorac081
AddOn Development
*
Offline Offline

Posts: 1706



« Reply #19 on: January 27, 2010, 05:19:45 PM »

Hi,

Shall I post this droplet to AMASP ?
Logged

Wow, I coded something myself: PM Messanger Modul ,Searchbox with suggestions
WebBird
Guest
« Reply #20 on: January 27, 2010, 05:23:35 PM »

If it's fixed (throws no errors) und works nicely, why not? grin
Logged
crnogorac081
AddOn Development
*
Offline Offline

Posts: 1706



« 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

Wow, I coded something myself: PM Messanger Modul ,Searchbox with suggestions
WebBird
Guest
« 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
Pages: [1]   Go Up
Print
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.16 | SMF © 2011, Simple Machines Valid XHTML 1.0! Valid CSS!