(Tutorial) Theming The Drupal Gallery Module
Theming The Drupal Gallery Modul
- Modify the image gallery templates:
-
-
<?php/*image gallery*/function phptemplate_image_gallery($galleries, $images) { drupal_add_css(drupal_get_path('module', 'image_gallery') .'/image_gallery.css'); drupal_add_js($data = 'misc/jquery.js', $type='theme', $scope='header', $defer=FALSE, $cache=TRUE); drupal_add_js($data = path_to_theme().'/jquery_gallery.js', $type='theme', $scope='header', $defer=FALSE, $cache=TRUE); // We'll add height to keep thumbnails lined up. $size = _image_get_dimensions('thumbnail'); $width = $size['width']; $height = $size['height']; $content = ''; if (count($galleries)) { $content.= '<ul class="galleries">'; foreach ($galleries as $gallery) {// $content .= '<li style="height : '.$height .'px">'; $content .= '<li>'; if ($gallery->count) $content.= "<h3>".l($gallery->name, 'image/tid/'.$gallery->tid) . "</h3>\n"; $content.= l(image_display($gallery->latest, 'thumpnail_gallery'), 'image/tid/'.$gallery->tid, array(), NULL, NULL, FALSE, TRUE); $content.= '<div class="description">'. check_markup($gallery->description) ."</div>\n"; //$content.= '<p class="count">' . format_plural($gallery->count, '1', ' @count images') . "</p>\n"; // if ($gallery->latest->changed) { // $content.= '<p class="last">'. t('Last updated: %date', array('%date' => format_date($gallery->latest->changed))) . "</p>\n"; // } $content.= "</li>\n"; } $content.= "</ul>\n"; } if (count($images)) { $content.= '<div id="gallery_thumpnail" class="blockElm">'; $content.= '<ul class="images">'; foreach ($images as $image) { $content .= '<li'; if ($image->sticky) { $content .= ' class="sticky"'; } $content .= ">\n"; $content .= l(image_display($image, 'thumbnail'), 'files/'.$image->images[preview], array("title"=>"$image->title"), NULL, NULL, FALSE, TRUE); $content .= "</li>\n"; } $content.= "</ul>\n</div>\n\n"; $content.= '<div id="gallery_image_placeholder" class="blockElm">';// $content .= '<h3 id="description">'.$image->title."</h3>"; $content.= image_display($image, 'gallery', array("id"=>"gallery_image")); $content.= '</div>'; } if ($pager = theme('pager', NULL, variable_get('image_images_per_page', 6), 0)) { $content.= $pager; } If (count($images) + count($galleries) == 0) { $content.= '<p class="count">' . format_plural(0, 'There is 1 image in this gallery', 'There are @count images in this gallery') . "</p>\n"; } return $content;}?>
-
Courtesy : http://morten.dk
- guru's blog
- Login to post comments
![Drupal-6-Book-[Building Powerful and Robust Websites with Drupal 6].jpg](http://www.drupalranch.com/images/Drupal-6-Book-[Building%20Powerful%20and%20Robust%20Websites%20with%20Drupal%206].jpg)