categories php,categories.php

// +---------------------------------------------+

// | 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, ' category.gif  ') . Iif($imagescount, ' ') . $siteicategories[$key]['title'] . Iif($imagescount, '') . ' (' . $imagescount . ')
'.Iif($clevel==1, ''%20.%20%24toggleicon%20.%20'  ').'
'. 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

原始数据

按行查看

历史

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值