Bonjour,
voici une solution pour mettre en place un script de type lightbox avec le module Xcgallery;
Après quelques recherches, le site xoops allemand en parle et propose meme un module tout pret
icije l'ai testé mais il ne me plait pas car on n'avait plus accès aux commentaires des photos,
je vous propose donc ma méthode qui n'abime pas le module existant
Tout se passe dans 3 fichiers:
xcgal/include/functions.inc.php
xcgal/include/theme_func.php
et
xcgal_thumb.html (templates)
dans le fichier
functions.inc.php on récupère l'adresse, le titre de l'image et le nom du fichier// Prints thumbnails of pictures in an album
function display_thumbnails($album, $cat, $page, $thumbcols, $thumbrows, $display_tabs)
{
global $xoopsModuleConfig, $xoopsTpl;
$myts =& MyTextSanitizer::getInstance(); // MyTextSanitizer object
$thumb_per_page = $thumbcols * $thumbrows;
$lower_limit = ($page-1) * $thumb_per_page;
$pic_data = get_pic_data($album, $thumb_count, $album_name, $lower_limit, $thumb_per_page);
$total_pages = ceil($thumb_count / $thumb_per_page);
$i = 0;
if (count($pic_data) > 0) {
foreach ($pic_data as $key => $row) {
$i++;
$image_size = compute_img_size($row['pwidth'], $row['pheight'], $xoopsModuleConfig['thumb_width']);
$pic_title =_MD_FUNC_FNAME.$myts->makeTBoxData4Show($row['filename'])."\n".
_MD_FUNC_FSIZE.($row['filesize'] >> 10)._MD_KB."\n".
_MD_FUNC_DIM.$row['pwidth']."x".$row['pheight']."\n".
_MD_FUNC_DATE.formatTimestamp($row['ctime'],'m');
$thumb_list[$i]['pos'] = $key < 0 ? $key : $i - 1 + $lower_limit;
$thumb_list[$i]['image'] = "<img src=\"" . get_pic_url($row, 'thumb') . "\" class=\"image\" {$image_size['geom']} border=\"0\" alt=\"{$row['filename']}\" title=\"$pic_title\" />";
$thumb_list[$i]['caption'] = ($row['caption_text']);
$thumb_list[$i]['admin_menu'] = '';
$thumb_list[$i]['pid'] = $row['pid'];
######mofif galerie lightbox
$thumb_list[$i]['url_image'] = get_pic_url($row, 'fullsize');
$thumb_list[$i]['titre_photo'] = $myts->makeTBoxData4Show($row['title']);
$thumb_list[$i]['nom_du_fichier'] = $myts->makeTBoxData4Show($row['filename']);
###### fin mofif galerie lightbox }
$xoopsTpl->assign('no_img',0);
theme_display_thumbnails($thumb_list, $thumb_count, $album_name, $album, $cat, $page, $total_pages, is_numeric($album), $display_tabs);
} else {
$xoopsTpl->assign('no_img',1);
$xoopsTpl->assign('lang_no_img',_MD_NO_IMG_TO_DISPLAY);
$xoopsTpl->assign('album_name',$myts->makeTBoxData4Show($album_name));
}
}
dans le fichier
theme.func.php on passe les variablesfunction theme_display_thumbnails(&$thumb_list, $nbThumb, $album_name, $aid, $cat, $page, $total_pages, $sort_options, $display_tabs, $mode='thumb')
{
global $xoopsModuleConfig,$xoopsTpl;
global $template_tab_display;
$cat_link= is_numeric($aid) ? '' : '&cat='.$cat;
$theme_thumb_tab_tmpl = $template_tab_display;
if ($mode == 'thumb') {
$theme_thumb_tab_tmpl['left_text'] = strtr($theme_thumb_tab_tmpl['left_text'], array('{LEFT_TEXT}' => _MD_THM_PICPAGE));
$theme_thumb_tab_tmpl['inactive_tab'] = strtr($theme_thumb_tab_tmpl['inactive_tab'], array('{LINK}' => 'thumbnails.php?album='.$aid.$cat_link.'&page=%d'));
} else {
$theme_thumb_tab_tmpl['left_text'] = strtr($theme_thumb_tab_tmpl['left_text'], array('{LEFT_TEXT}' => _MD_THM_USERPAGE));
$theme_thumb_tab_tmpl['inactive_tab'] = strtr($theme_thumb_tab_tmpl['inactive_tab'], array('{LINK}' => 'index.php?cat='.$cat.'&page=%d'));
}
$thumbcols = $xoopsModuleConfig['thumbcols'];
$cell_width = ceil(100/$xoopsModuleConfig['thumbcols']).'%';
$tabs_html = $display_tabs ? create_tabs($nbThumb, $page, $total_pages, $theme_thumb_tab_tmpl) : '';
$i = 0;
foreach($thumb_list as $thumb){
$i++;
$pic= array();
$pic['thumb']=$thumb['image'];
###modif galerie lightbox
$pic['image_box'] = (!empty($thumb['url_image'])) ? $thumb['url_image'] : "";
$pic['titrephoto'] =$thumb['titre_photo'];
$pic['nomdufichier'] =$thumb['nom_du_fichier'];
###fin modif galerie lightbox
if (is_array($thumb['caption'])){
$pic['user']=1;
$pic['u_name']=$thumb['caption']['u_name'];
$pic['u_id']=$thumb['caption']['u_id'];
$pic['albums']=$thumb['caption']['albums'];
$pic['pictures']=$thumb['caption']['pictures'];
.....
et pour finir dans
xcgal_thumb.html avec
lyteboxcliquer en dessous de la vignette permet de lancer le script;
dans la galerie on met le nom de l'album et le titre de la photo (s'il n'y a pas de titre, on affiche le nom du fichier). <{foreach item=pic from=$thumb.pics}>
<td valign="top" class="even" width ="<{$thumb.cell_width}>" align="center">
<table width="100%" cellpadding="0" cellspacing="0">
<tr>
<td align="center">
<a href="<{$pic.link_tgt}>"><{$pic.thumb}><br /></a>
<{if $pic.user == 1}>
<table cellspacing="1" cellpadding="0" border="0" width="100%" class="user_thumb_infobox">
<tr>
<th><a href="<{$xoops_url}>/userinfo.php?uid=<{$pic.u_id}>"><{$pic.u_name}></a></th>
</tr>
<tr>
<td><{$pic.albums}></td>
</tr>
<tr>
<td><{$pic.pictures}></td>
</tr>
</table>
<{else}>
<{if $pic.caption!=''}>
<{if $pic.titrephoto==''}>
<a href="<{$pic.image_box}>" rel="lyteshow[vacation]"
title="<a href=<{$pic.link_tgt}>><{$thumb.album_name}><br>
<i><font color='#CCCCCC'><{$pic.nomdufichier}></i></font></a>">
<{$pic.caption}></a>
<{else}>
<a href="<{$pic.image_box}>" rel="lyteshow[vacation]"
title="<a href=<{$pic.link_tgt}>><{$thumb.album_name}><br><{$pic.titrephoto}></a>">
<{$pic.caption}></a>
<{/if}>
<{else}>
<{if $pic.titrephoto==''}>
<font style="font-style: oblique; font-size:6px;">
<a href="<{$pic.image_box}>" rel="lyteshow[vacation]"
title="<a href=<{$pic.link_tgt}>><{$thumb.album_name}><br>
<i><font color='#CCCCCC'><{$pic.nomdufichier}></i></a>">
<font color="#CCCCCC"><{$thumb.album_name}></font>
</a>
</font>
<{else}>
<font style="font-style: oblique; font-size:6px;">
<a href="<{$pic.image_box}>" rel="lyteshow[vacation]"
title="<a href=<{$pic.link_tgt}>><{$thumb.album_name}><br><{$pic.titrephoto}></a>">
<font color="#CCCCCC"><{$thumb.album_name}></font>
</a>
</font>
<{/if}>
<{/if}>
<{/if}>
<{$pic.admin_menu}>
</td>
</tr>
</table>
</td>
<{if $pic.row_sep==1}>
</tr>
<tr>
<{/if}>
<{/foreach}>
......
voilà, en vous souhaitant de bonnes fêtes !
