// +---------------------------------------------+
// | Copyright 2010 - 2018 InterPhoto |
// | http://www.weentech.com |
// | This file may not be redistributed. |
// +---------------------------------------------+
include('includes/InterPhoto.Core.php');
/ FUNCTIONS /
function GetAllCategories($parentid, $clevel = 0){
global $DB, $siteicategories, $icategoryparentids;
if($parentid != 0){
$clevel = 2;
}else{
$clevel = 1;
}
$sReturn = '';
$allicategoryparentids = $icategoryparentids;
foreach($allicategoryparentids as $key => $value){
if($parentid == $value){
$displaycookie = ForceIncomingCookie('IPCZOOM'.COOKIE_KEY.'c_'.$key, 1);
if($displaycookie){
$display = 'block';
$toggleicon = 'zoomout.gif';
}else{
$display = 'none';
$toggleicon = 'zoomin.gif';
}
$imagescount = $siteicategories[$key]['images'];
$sReturn .= '
'.Iif($imagescount, '
'.Iif($clevel==1, '![]() |
---|
'. Html($siteicategories[$key]['description']);
$sReturn .= GetAllCategories($key, $clevel); $sReturn .= ' |
}
}
return $sReturn;
}
/ FUNCTIONS /
$smarty = new InterPhoto;
$siteicategories = array();
$icategoryparentids = array();
$geticategories = $DB->query("SELECT c.categoryid, c.parentid, c.title, c.description, COUNT(i.imageid) AS images FROM " . TABLE_PREFIX . "categories c LEFT JOIN " . TABLE_PREFIX . "images i ON (i.categoryid = c.categoryid AND i.actived = 1) WHERE c.actived = 1 GROUP BY c.categoryid ORDER BY c.ordernum ASC");
while($icategory = $DB->getrow($geticategories)){
$siteicategories[$icategory['categoryid']] = $icategory;
$icategoryparentids[$icategory['categoryid']] = $icategory['parentid'];
}
$togglesrcipt = '
{
var getelm = document.getElementById(elm);
if(!getelm) {
return false;
}else{
if(getelm.style.display==\'none\'){
getelm.style.display=\'block\';
i.src = i.src.replace(\'zoomin.gif\', \'zoomout.gif\');
setCookie(\'IPCZOOM'.COOKIE_KEY.'\'+elm, 1, 7);
}else{
getelm.style.display=\'none\';
i.src = i.src.replace(\'zoomout.gif\', \'zoomin.gif\');
setCookie(\'IPCZOOM'.COOKIE_KEY.'\'+elm, 0, 7);
}
}
}';
$smarty->assign('togglesrcipt', $togglesrcipt);
$smarty->assign('allcategories', GetAllCategories(0));
$pagenav = ''.$langs['home'].' '.$langs['nav'].' '.$langs['categories'].'';
//Always needing
$smarty->assign('pagenav', $pagenav);
$smarty->assign('userinfo', $userinfo);
$smarty->assign('pagetitle', $langs['categories'] . ' - ' .$mainsettings['siteTitle']);
$smarty->interPlay('categories.tpl');
?>
一键复制
编辑
Web IDE
原始数据
按行查看
历史