您在這裡

Image gallery字跟圖擠在一起

liaozi's 的頭像
liaozi 在 2007-03-29 (四) 14:38 發表

狀況如附件圖檔,我的圖很多,因此有很多頁,不過選頁的部份被我的名字與發表日期檔住了,請教一下這個有辦法修嗎?

附加檔案大小
Image icon image.jpg82.79 KB

可以把 image gallery 分離出來,放在 theme 中,檔案為 image_gallery.tpl.php , 再配合 CSS 調整。附一個例子給你參考,相關的變數要看你自己的需求調整。

EX: image_gallery.tpl.php

<?php
global $image_images_per_page;
drupal_set_html_head(theme('stylesheet_import', base_path() . drupal_get_path('module', 'image_gallery') .'/image_gallery.css'));
$size = _image_get_dimensions('thumbnail');
$width = $size['width'];
$height = $size['height'];
$height_table = $size['height'] + 20;

$content = '';
if (count($galleries)) {
$content.= '

    ';
    foreach ($galleries as $gallery) {
    $content .= '
  • ';
    if ($gallery->count)
    $content.= l(image_display($gallery->latest, 'thumbnail'), 'image/tid/'.$gallery->tid, array(), NULL, NULL, FALSE, TRUE);
    $content.= "".l($gallery->name, 'image/tid/'.$gallery->tid) . "\n";
    $content.= '
    '. $gallery->description ."

    \n";
    $content.= '' . format_plural($gallery->count, 'There is 1 image in this gallery', 'There are %count images in this gallery') . "\n";
    if ($gallery->latest->changed) {
    $content.= ''. t('Last updated: %date', array('%date' => format_date($gallery->latest->changed))) . "\n";
    }
    $content.= "

  • \n";
    }
    $content.= "

\n";
}

if (count($images)) {
$height += 60;
$width2 = $width += 25;
$content.= '

    ';
    foreach ($images as $image) {
    $content .= '
  • sticky) {
    $content .= ' class="sticky"';
    }
    $content .= ' style="height : '.$height .'px; width : '.$width2.'px; background-image: none; padding-left:0px;"';
    $content .= ">\n";
    $content .= l(image_display($image, 'thumbnail'), 'node/'.$image->nid, array(), NULL, NULL, FALSE, TRUE);
    $content .= ''.l($image->title, 'node/'.$image->nid)."";
    if (theme_get_setting('toggle_node_info_' . $image->type)) {
    $content .= '
    '. t('Posted by: %name', array('%name' => theme('username', $image))) . "

    \n";
    if ($image->created > 0) {
    $content .= '

    '.format_date($image->created)."

    \n";
    }
    }
    $content .= "

  • \n";
    }
    $content.= "

  •  
  • \n";
    $content.= "

\n";
}

If (count($images) + count($galleries) == 0) {
$content.= '' . format_plural(0, 'There is 1 image in this gallery', 'There are %count images in this gallery') . "\n";
}
if ($pager = theme('pager', NULL, variable_get('image_images_per_page', 6), 0)) {
$content.= $pager;
}
print $content;
?>