Forumlar / Cotonti / Extensions / Work in progress: Basic gallery with jQuery Lightbox

booka
#24346 2010-04-26 03:35
require("system/config.extensions.php");

to

require("datas/extensions.php");


Добавлено 5 Минут спустя:

and how to show icon instead of thumbnail?

Добавлено 42 Минуты спустя:

and another problem - {PLUGIN_RANDIMG} just show all pictures from folder... and lighbox doesn't work with that tag

Добавлено 9 Минут спустя:

think problem is somewhere with SQL request, because phpmyadmin returns a lot of files instead of one:

SELECT pfs.pfs_file, pff.pff_id, pff.pff_title FROM sed_pfs AS pfs INNER JOIN sed_pfs_folders AS pff ON pfs.pfs_folderid=pff.pff_id WHERE pff.pff_ispublic='1' AND pff.pff_isgallery='1' ORDER BY RAND() LIMIT 20


Добавлено 3 Минуты спустя:

ouh...

this would be correct:

SELECT pfs.pfs_file, pff.pff_id, pff.pff_title FROM sed_pfs AS pfs INNER JOIN sed_pfs_folders AS pff ON pfs.pfs_folderid=pff.pff_id WHERE pff.pff_ispublic='1' AND pff.pff_isgallery='1' ORDER BY RAND() LIMIT 1

but I still have problem with light box here... it is ok on plugin page

Добавлено 27 Минут спустя:

so this is a working code (changed to footer.tags):

<?PHP

/* ====================
Cotonti - Content Management Framework
Copyright Cotonti Team
http://www.cotonti.com

[BEGIN_SED]
File=plugins/gallery/gallery.footer.php
Version=100
Updated=2008-feb-5
Type=Plugin
Author=Koradhil
Description=Display a gallery of PFS images (marked 'public' and 'gallery')
[END_SED]

[BEGIN_SED_EXTPLUGIN]
Code=gallery
Part=footer
File=gallery.footer
Hooks=footer.tags
Tags=rooter.tpl:{PLUGIN_FOOTER_RANDIMG_TITLE},{PLUGIN_FOOTER_RANDIMG}
Order=10
[END_SED_EXTPLUGIN]
==================== */

/**
 * @package Cotonti
 * @version 0.0.2
 * @copyright Partial copyright (c) 2008 Cotonti Team
 * @license BSD License
 */

if (!defined('SED_CODE')) { die('Wrong URL.'); }

require("plugins/gallery/lang/gallery.".$cfg['defaultlang'].".lang.php");

//Link to gallery folder (without ID, for rewrite purposes)
$folderurl = 'plug.php?e=gallery&amp;f=';

$randimg ='
<link href="js/jquery.lightbox-0.5.css" type="text/css" rel="stylesheet" media="screen" />
<script type="text/javascript" src="js/jquery.lightbox-0.5.js"></script>
<script type="text/javascript"> 
    $(function() {
        $(\'#gallery a\').lightBox();
    });
</script>
';



$sql = sed_sql_query("SELECT pfs.pfs_file, pff.pff_id, pff.pff_title FROM $db_pfs AS pfs INNER JOIN $db_pfs_folders AS pff ON pfs.pfs_folderid=pff.pff_id WHERE pff.pff_ispublic='1' AND pff.pff_isgallery='1' ORDER BY RAND() LIMIT 1");
if (mysql_num_rows($sql)>0) {
	$randimg .= "<div style='text-align:left; width:100%;'>";
	while ($row = mysql_fetch_array($sql)) {
		$randimg .= '<div id=\'gallery\'><div id="image"><a href="datas/users/'.$row['pfs_file'].'"><img src="datas/thumbs/'.$row['pfs_file'].'" alt="" /></a></div></div>';
		$randimg .= $L['gal_from'].': <a href="'.$folderurl.$row['pff_id'].'">'.$img.$row['pff_title'].'</a><br /><br />';
	}
	$randimg .= '</div>';
}
else {
	$randimg .= $L['gal_none'];
}

$t-> assign(array(
	"PLUGIN_FOOTER_RANDIMG_TITLE" => $L['gal_randimg'],
	"PLUGIN_FOOTER_RANDIMG" => $randimg,
));

?>


Добавлено 20 дней спустя:

I have 1 bug with random image:

http://www.bestfest.ru/plug.php?e=gallery

2 images from the left... why? )
booka

Bu konu booka tarafından düzenlendi(2010-05-16 05:55, 13 yıllar önce)