Location: PHPKode > projects > ArticleSetup > ArticleSetup-v1-1/upload/sidebar.php
<?php 

// Setup this page's template information 
// $sidebardir gets the relative directory from main site or /author  
	$sidebar = new Template($sidebardir."templates/".$template."/sidebar.tpl");

// Check if  user is logged in. If so, display custom menu
	session_start();
	if (isset($_SESSION['valid_user'])) { 
		
		$sidebar->set("authormenu", '
		<h3>Author Navigation</h3>
		<div class="author-list">
		<ul>
			<li><a href="'.$siteurl.'/author/index.php">Dashboard Home</a></li>
			<li><a href="'.$siteurl.'/author/submit.php">Submit an Article</a></li>
			<li><a href="'.$siteurl.'/author/articles.php">View & Edit Articles</a></li>
			<li><a href="'.$siteurl.'/author/profile.php">Update Your Profile</a></li>
			<li><a href="'.$siteurl.'/author/settings.php">Account Settings</a></li>
			<li><a href="'.$siteurl.'/author/logout.php">Logout</a></li>
		</ul>
		<br style="clear:left"/>
		</div>

		<br/>');
	} else {
		$sidebar->set("authormenu", '');
	}

// Print the 120 x XXX sidebar code
	$query = "select * from adboxes where id=3;"; 
	$result = mysql_query($query,$connection) or die(mysql_error());
	$info = mysql_fetch_assoc($result);

	$sidebar->set("120adcode", stripslashes($info['adcode'])); 



// Populates the sidebar with all categories 
	$query = "select * from categories where parentid is null order by name;"; 
	$result = mysql_query($query,$connection) or die(mysql_error());
	$num_results = mysql_num_rows($result);
		
	for ($i=0; $i <$num_results; $i++) { 
		$row = mysql_fetch_assoc($result);
		if ($seourls == 1) { $scrubcatname = generate_seo_link($row['name']); }
		
		if ($seourls == 1) { // With SEO URLS 
			$list = "<li><a href=\"".$siteurl."/category/".$row['id']."/".$scrubcatname."/\">
			".$row['name']."</a></li>"; 
			$output .= $list;
		} else {
			$list = "<li><a href=\"".$siteurl."/category.php?id=".$row['id']."\">".$row['name']."</a></li>";
			$output .= $list;
		}
		$sidebar->set("sidecats", $output); 
	}
	


// Populates the sidebar with all pages
	$query = "select * from pages;"; 
	$result = mysql_query($query,$connection) or die(mysql_error());
	$num_results = mysql_num_rows($result);
	
	if (!$num_results) {
		$sidebar->set("sidepages", "");
	} else {

		for ($i=0; $i <$num_results; $i++) { 
			$row = mysql_fetch_assoc($result); 
		
			if ($seourls == 1) { $scrubtitle = generate_seo_link($row['title']); }
		
			if ($seourls == 1) { // With SEO URLS 
				$pagelist = "<li><a href=\"".$siteurl."/page/".$row['id']."/".$scrubtitle."/\">
				".$row['title']."</a></li>";
				$pageoutput .= $pagelist; 
			} else {
				$pagelist = "<li><a href=\"".$siteurl."/page.php?p=".$row['id']."\">".$row['title']."</a></li>";
				$pageoutput .= $pagelist; 
			}
			$sidebar->set("sidepages", $pageoutput); 
		}
	}
	

// Outputs the sidebar template!
	 
	echo $sidebar->output();

?>
Return current item: ArticleSetup