Location: PHPKode > projects > Tagging manager > version 1.02/list.php
<?php
/**
 * list.php lists urls together with their info (description, tags)
 *
 * It uses index_list.tpl and body_list.tpl as it's main templates	
 * Most important variable is $valid_columns: an array that says what list can get from the url
 * for example:  list.php?tag_name=sometag&lang=nl&taxonomy=news&userName=admin
 *
 * @author hide@address.com
 * @version 1.0
 * @package TaggingManager
 */
 
	if(!file_exists( "./config.php" ) ) {
	die( 'Please rename config.new to config.php and fill in the data' );
	}
  $root_path = './';
  

	/**
 	* Including the configfile: contains all important data
 	*/
  include_once($root_path.'config.php');
  
	
	if($db_name=='') 	die( 'Please fill in the correct mysql data in config.php' );
	/**
	 * Including the dbconn: contains db-class
	 */
  require_once($root_path.'includes/dbconn.php');
 
	/**
	 * Including all functions
	 */ 
  require_once($root_path.'includes/functions.php');
  
	/**
	 * Including template engine
	 */   
  require_once($root_path.'includes/template.php');
  
	/**
	 * Including metadata
	 */    
  require_once($root_path.'includes/metadata.php');
  
	/**
	 * Including userinformation
	 */    
  require_once($root_path.'includes/user.php');

  
// GET tag,lang, page ... by url
isset($_GET['pag']) ? $pag=$_GET['pag'] : $pag = 1;
$paging=($pag-1)*$paglimit;

!isset($_GET["search"])? $search = "AND" :  $search = $_GET["search"];
$search .= " ";

$valid_columns = Array("tag_name","lang", "taxonomy", "userName"); //Valid columns for search

	
foreach ($_GET as $key=>$val)
		{
  	if (in_array($key,$valid_columns))
  		$str .= "$key = '$val' ". $search;
		}
		if (count($_GET) > 0)
  		$str  = substr($str, 0,-strlen($search));
		else
  		$str ="";

$where = "";
if (strlen($str) > 0) $where = "WHERE " . $str;
$ids = urlIDs($where,$paging,$paglimit); //returns an array of id's for this search

$paging = "";

if (count($ids) == $paglimit) $nextpage = $pag + 1; 
if ($pag > 1) $previouspage = $pag - 1; 
$url2 = ChangeQuery("+",array("pag",$nextpage),$url2);


if (isset ($previouspage)) {
	$url1 = ChangeQuery("+",array("pag",$previouspage),$url1);
	$paging = "<a href='$url1'><img src='template/default/img/nav_left_blue.png'  border='0'></a>"; 
	} else { 
	$paging =  "<img src='template/default/img/nav_left_grey.png'  border='0'>"; 
	}
	
if (isset ($nextpage)) { 
	$url2 = ChangeQuery("+",array("pag",$nextpage),$url2);
	$paging .=  "<a href='$url2'><img src='template/default/img/nav_right_blue.png' border='0'></a>";
	} else {
	$paging .= "<img src='template/default/img/nav_right_grey.png'  border='0'>";
	} 
	

	

isset($_GET['style']) ? $template=$_GET['style'] : $template=$template;


//start templatebuilding
$tpl = & new Template();
$tpl->set('tagg', $_GET['tag_name']);
$tpl->set('taxonomy', $_GET['taxonomy']);
$tpl->set('location', $location);


if (isset($_COOKIE["user"]) AND isset($_COOKIE["secret"])) {
$myUser = new User;
$myUser->userName = $_COOKIE["user"];
$myUser->userPassword = $_COOKIE["secret"];
$myUser->verifyPassword();
$tpl->set('user_id', $myUser->user_id);
$tpl->set('username', $myUser->userName);
}



foreach($ids as $id){ 
$link = new Link($id);
$bdy = & new Template();
$bdy->set('url', $link->url);
$bdy->set('link_title', $link->title);
$bdy->set('link_description', $link->description);
$bdy->set('link_snipset', $link->snipset);
$bdy->set('link_taxonomy', $link->taxonomy);
$bdy->set('link_id', $link->meta_id);
$bdy->set('location', $location);
$tagList = tagList($link->meta_id); //this is an array with all the tags for this url
$bdy->set('link_taglist', $tagList);
$body .= $bdy->fetch($root_path.'template/'.$template.'/body_list.tpl',$language);
}


$tpl->set('paging', $paging);
$tpl->set('body', $body);

if ($_GET['style'] == 'rss') header('Content-type: text/xml');

echo $tpl->fetch($root_path.'template/'.$template.'/index_list.tpl',$language);
?>
Return current item: Tagging manager