<?php
/**
 * @version $Id: tag.php v2.0 $
 * @package PBDigg
 * @copyright Copyright (C) 2007 - 2008 PBDigg.com. All Rights Reserved.
 * @license PBDigg is free software and use is subject to license terms
 */

define('PB_CSCRIPT', 'tag');
require_once('include/common.inc.php');

$rs = $tags = array();
$pagesize = (int)$pb_tperpage;
$rs = $DB->db_fetch_one_array("SELECT COUNT(*) num FROM {$db_prefix}tags WHERE ifopen = 1");
$totalRecords = (int)$rs['num'];
$page = !is_Page($page) ? 1 : $page;
$start_limit = ($page -1) * $pagesize;
$mult = multLink($page, $totalRecords, 'tag.php?', $pagesize);
$DB->db_query('SELECT tagname, usenum FROM '.$db_prefix.'tags WHERE ifopen = 1 LIMIT '.$start_limit.', '.$pagesize);
while ($rs = $DB->db_fetch_array())
{
	$tags[] = array(rawurlencode($rs['tagname']), $rs['tagname'], $rs['usenum'], getTagStyle());
}

$seo['pagetitle'] = $seo['keywords'] = $seo['description'] = $u_message['tag'];
$TPL->assign('seo', $seo);
$TPL->assign('mult_page', $mult);
$TPL->assign('tags', $tags);

PBOutPut('tag.html');
?>
