Location: PHPKode > projects > Automated Tutorials Script > TG Client/tutorials.php
<?php
	
	include("init.php");
	$tpl = new TemplatePower("templates/".$config['site_template']."/tutorials.html");
	$tpl->assignInclude("header", "templates/".$config['site_template']."/header.html");
	$tpl->assignInclude("footer", "templates/".$config['site_template']."/footer.html");
	$tpl->prepare();
	
	
	require_once("inc/pagehead.php");
	
	$tutorialMetaData = $tutorialListArray['tutorialsdata']['metadata'];
	foreach($tutorialListArray['tutorialsdata']['tutoriallist'] as $tutorialList)
	{
		//printArray($tutorialList);
		if(is_array($tutorialList))
		{
			if(!array_key_exists("id", $tutorialList))
			{
				foreach($tutorialList as $key=>$tutorialInfo)
				{
					$tpl->newBlock("TUTORIALLIST");
					$tpl->assign("TUTORIALTITLE", $tutorialInfo['title']);
					$tpl->assign("TUTORIALTHUMBNAIL", $tutorialInfo['thumbnail']);
					$tpl->assign("TUTORIALURL", $tutorialInfo['tutorialurl']);
					$tpl->assign("TUTORIALAUTHOR", $tutorialInfo['author']);
					$tpl->assign("TUTORIALDATE", date("d F Y", strtotime($tutorialInfo['added'])));
					$tpl->assign("TUTORIALCATEGORY", $simpleCategoryArray[$tutorialInfo['category']]);
					$tpl->assign("TUTORIALSUBCATEGORY", $simpleSubCategoryArray[$tutorialInfo['subcategory']]);
					$tpl->assign("TUTORIALDIFFICULTY", $tutorialInfo['difficulty']);
					$tpl->assign("TUTORIALVIEWS", $tutorialInfo['views']);
					$tpl->assign("TUTORIALVOTES", $tutorialInfo['votes']);
					$tpl->assign("TUTORIALRATING", $tutorialInfo['rating']);
				}
			}
			else
			{
				$tpl->newBlock("TUTORIALLIST");
				$tpl->assign("TUTORIALTITLE", $tutorialList['title']);
				$tpl->assign("TUTORIALTHUMBNAIL", $tutorialList['thumbnail']);
				$tpl->assign("TUTORIALURL", $tutorialList['tutorialurl']);
				$tpl->assign("TUTORIALAUTHOR", $tutorialList['author']);
				$tpl->assign("TUTORIALDATE", date("d F Y", strtotime($tutorialList['added'])));
				$tpl->assign("TUTORIALCATEGORY", $simpleCategoryArray[$tutorialList['category']]);
				$tpl->assign("TUTORIALSUBCATEGORY", $simpleSubCategoryArray[$tutorialList['subcategory']]);
				$tpl->assign("TUTORIALDIFFICULTY", $tutorialList['difficulty']);
				$tpl->assign("TUTORIALVIEWS", $tutorialList['views']);
				$tpl->assign("TUTORIALVOTES", $tutorialList['votes']);
				$tpl->assign("TUTORIALRATING", $tutorialList['rating']);
			}
			
			$nav = "";
			$page = $_GET['page'];
			if($page == "")
				$page = 1;
			
			for($i = 1; $i <= $tutorialMetaData['totalpages']; $i++)
			{
				if($i == $page)
					$nav .= "<strong>$i</strong> | ";
				else
				{
					$nav .= "<a href='?";
					if ($_GET['category'] != "")
						$nav .= "category=$_GET[category]&";
					if ($_GET['subcategory'] != "")
						$nav .= "subcategory=$_GET[subcategory]&";
					$nav .= "page=$i'>$i</a> | ";
				}
			}
			$nav = substr($nav, 0, strlen($nav) - 3);
			
			$tpl->newBlock("PAGING");
			$tpl->assign("PAGINATION", $nav);
		}
		else
		{
			$tpl->newBlock("NOTUTORIAL");
		}
	}	
	
	$tpl->printToScreen();
	
?>
Return current item: Automated Tutorials Script