WebsiteBaker 2.13.9 is now available!
R.I.P Dietmar (luisehahne) and thank you for all your valuable work for WBhttps://forum.websitebaker.org/index.php/topic,32355.0.html
Thanks for response,I will test it later and probably adapt parts of your code.Should be &sort= not &order=Yes, it's obvious, thank you.Kind regards,Stefek
$folder=trim($folder);
prompt("Copy this to clipboard and paste to a page editor", "[[microGallery?folder=gallery34&group=lightbox&sort=DESC]]");
{MICROGALLERYADD} {TEXT_CURRENT_FOLDER}: {MEDIA_DIRECTORY}{CURRENT_DIR}
if(strlen($directory)<1)$microgallerydirectory='';else $microgallerydirectory='<a href="#" onclick="prompt(\'Copy this to clipboard and paste to a page editor\', \'[[microGallery?folder='.ltrim($directory, "/").'&group=lightbox&sort=DESC]]\');return false";> Get gallery code</a> ::';
'INCLUDE_PATH' => WB_URL.'/include','MICROGALLERYADD' => $microgallerydirectory
if (!preg_match('/.+\.(jpeg|jpg|gif|png)$/', $image_file) || -->// HELP! CANNOT ADD /i without giving error ?!!?$img_title = str_replace(array(".png", ".jpg", ".gif", ".jpeg"), "", $image_file);-->$img_title = str_ireplace(array(".png", ".jpg", ".gif", ".jpeg"), "", $image_file); //ireplace
if (!preg_match('/.+\.(jpeg|jpg|gif|png|JPG|JPEG)$/', $image_file) ||
Added aksort to my droplet and it works fine.
<?php // ---> snippet // check sorting if((isset($sort) && $display == 'table') || (isset($sort) && $display == 'all')){ if($sort=='ASC') asort($image_show); if($sort=='DESC') rsort($image_show); if($sort=='RANDOM') shuffle($image_show); }
<?php case 'one': //&display=one $output_value = $image_show[0]; array_shift($image_array); //skip first Element of Array $output_value .= '<ul style="display:none">'; foreach ($image_array as $image){ $output_value .= '<li>'.$image.'</li>'; } $output_value .= '</ul>'; break;
var $gallery, previous, next; next = $.fn.colorbox.next; $.fn.colorbox.next = function(){ if($gallery.index(previous) == ($gallery.length - 1)){ $.fn.colorbox.close(); } else { next(); } }; $gallery = $("a[rel='cslide']"); $gallery.colorbox({onComplete: function(){ previous = this; }, onOpen: function(){ previous = this; }});
You may use this Droplet to place a (small)Gallery where ever you like (NEWS Posts etc.).This droplet, of course, doesn't replace a general image-gallery-module, but it comes in handy if you need to display some pictures from a media-directory without to much effort.
hi, the droplet-code is ok.please paste your code here, i'll check it.
<?php/* "microGallery - place Gallery anywhere" ---------------------------------------- @Author: Christian M. Stefan (Stefek) <stefek@designthings.de>*/global $MESSAGE;$output_value ="";// check if the 'folder' Parameter is set in the Dropletif (!isset($folder)): $output_value = $MESSAGE['MOD_FORM']['REQUIRED_FIELDS'].":<b>microGallery call =></b> <tt>folder={path/to/the/folder}</tt>";endif; $img_dir = WB_PATH.MEDIA_DIRECTORY.'/'.$folder.'/';$img_url = WB_URL.MEDIA_DIRECTORY.'/'.$folder.'/'; // directory exists --->if (is_dir($img_dir)): // open directory and go through the files $dir = dir($img_dir); while (FALSE !== $image_file = $dir->read()): //use jpg, gif and png files only if (!preg_match('/.+\.(jpeg|jpg|gif|png)$/', $image_file) || substr($image_file, 0, 1) == ".") continue; /** * Make Array of images for the microGallery if image files exist */ // convert filenames into Titles $img_title = str_replace(array(".png", ".jpg", ".gif", ".jpeg"), "", $image_file); $img_title = str_replace("_", " ", $img_title); if (isset($img_title) && !empty($img_title)): $link = $img_url.$image_file; $group = isset($group) ? $group : ''; //ignore $group if &group Parameter isn't set in Droplet-Call $image_array[] = "<a class='colorbox' href='".$link."' rel='lightbox[".$group."]' title='".$img_title."'>file'".$img_title."'</a>"; $linkonly[] = $link; $image_show[] = "<a class='colorbox' href='".$link."' rel='lightbox[".$group."]' title='".$img_title."'> <img src='".$link."' alt='".$img_title."' title='".$img_title."' style='width:auto; height:120px; border:0;'/></a>"; endif; endwhile; if(empty($image_show)): //no images in this directory $output_value = $MESSAGE['MEDIA']['NONE_FOUND'].': (<tt> '.$img_url.' </tt>)'; return $output_value; endif; /** * DISPLAY microGallery */ $display = (isset($display)) ? $display : 'table'; $cssclass = (isset($cssclass)) ? ' class="'.$cssclass.'"' : ''; //&cssclass=yourclass // check sorting if((isset($sort) && $display == 'table') || (isset($sort) && $display == 'all')){ if($sort=='ASC') asort($image_show); if($sort=='DESC') rsort($image_show); if($sort=='RANDOM') shuffle($image_show); } switch ($display): case 'table': //&display=table OR not-set at all $picsperrow = (isset($cols)) ? $cols : 4; // Set the amount of pics per row $output_value = "<table".$cssclass."><tr>"; for ($i=0; $i<count($image_show); $i++): if (($i > 0) && ($i % $picsperrow == 0)) $output_value .= "</tr><tr>"; $output_value .= "<td>".$image_show[$i]."</td>"; endfor; while ($i % $picsperrow > 0): $output_value .= "<td> </td>"; $i++; endwhile; $output_value .= "</tr></table>"; break; case 'all': //&display=all if(isset($sort) && $sort=='ASC') asort($image_show); if(isset($sort) && $sort=='DESC') rsort($image_show); if(isset($sort) && $sort=='RANDOM') shuffle($image_show); sort($image_show); $output_value = "<ul".$cssclass.">"; foreach ($image_show as $image){ $output_value .= '<li>'.$image.'</li>'; } $output_value .= '</ul>'; break; case 'first': //&display=first $output_value = $image_show[0]; break; case 'notfirst': //&display=notfirst array_shift($image_array); //skip first Element of Array $output_value = '<ul style="display:none">'; foreach ($image_array as $image){ $output_value .= '<li>'.$image.'</li>'; } $output_value .= '</ul>'; break; case 'firstlink': //&display=firstlink $output_value = $linkonly[0]; break; endswitch; // <-------end: if directory existselse: // directory doesn't exists ---> $output_value = $MESSAGE['MEDIA']['DIR_DOES_NOT_EXIST'].': (<tt> '.$img_url.' </tt>)';endif; return $output_value;
i test with 1.51 and the code is ok.the leading <?php is not needed, but the modul remove this for you.hm, what can be the problem?droplet-name, desc or comment?
Fatal error: Call to undefined function use_fancy_box() in /volume1/web/sandbox_wsb/modules/droplets/droplets.php(29) : eval()'d code on line 2
<?php/** * * @category module * @package droplets * @author Ruud Eisinga (Ruud) John (PCWacht) * @author WebsiteBaker Project * @copyright 2004-2009, Ryan Djurovich * @copyright 2009-2010, Website Baker Org. e.V. * @link http://www.websitebaker2.org/ * @license http://www.gnu.org/licenses/gpl.html * @platform WebsiteBaker 2.8.x * @requirements PHP 4.4.9 and higher * @version $Id$ * @filesource $HeadURL$ * @lastmodified $Date$ * * droplets are small codeblocks that are called from anywhere in the template. * To call a droplet just use [[dropletname]]. optional parameters for a droplet can be used like [[dropletname?parameter=value¶meter2=value]]\ * * 1.0.2, bugfix, Reused the evalDroplet function so the extracted parameters will be only available within the scope of the eval and cleared when ready. * 1.0.3, optimize, reduce memory consumption, increase speed, remove CSS, enable nested droplets * */ function do_eval($_x_codedata, $_x_varlist, &$wb_page_data) { extract($_x_varlist, EXTR_SKIP); return(eval($_x_codedata)); } function processDroplets( &$wb_page_data ) {// collect all droplets from document $droplet_tags = array(); $droplet_replacements = array(); if( preg_match_all( '/\[\[(.*?)\]\]/', $wb_page_data, $found_droplets ) ) { foreach( $found_droplets[1] as $droplet ) { if(array_key_exists( '[['.$droplet.']]', $droplet_tags) == false) {