Location: PHPKode > projects > Phpman > phpman-2.0a_RC2/includes/frontend.php
<?php
/**
* Content functions for phpman
* @package phpman
* @copyright (c) 2004 Samuel Suter
* @author Samuel Suter <hide@address.com>
* @license http://www.gnu.org/copyleft/gpl.html GNU General Public License
* @version 1.0
**/

/** include frontend HTML */
include(_mlsDocroot."includes/frontend.html.php");

function prevNextNavi($page_ID) {
	global $database,$manual_data;
	/** Load the given page */
	$table = new mlsDBTable("#__pages","page_ID",$database);
	$mypage = $table->load($page_ID);
	
	//$pages = get_pages_array($manual_data["root_ID"],0,$_GET["lang"],0,TRUE);
	$table = $tbl_prefix . "pages";
	$query = "SELECT a1.root_ID,a1.page_ID,a1.lft,a1.rgt,COUNT(*) AS `level` FROM `#__pages` AS a1, `#__pages` AS a2 WHERE  a1.root_ID='".$mypage["root_ID"]."' AND a2.root_ID='".$mypage["root_ID"]."' AND a1.lft BETWEEN a2.lft AND a2.rgt GROUP BY a1.lft";
	$database->setQuery($query);
	$pages = $database->loadRowsCustom2('root_ID','','page_ID');
	$pages = $pages[$manual_data["root_ID"]];
	$mykey = array_search($page_ID,$pages);
	
	$next = $mykey + 1;
	$next = getPageLang($pages[$next],$_GET["lang"]);
	$prev = $mykey - 1;
	$prev = getPageLang($pages[$prev],$_GET["lang"]);
	
	pmFrontendHTML::showPrevNext($prev,$next);
	$ret["prev"] = $prev;
	$ret["next"] = $next;
	return $ret;
};

/**
* print the small toc
* @return boolean always true
*/
function printSmalltoc() {
	/** print the small toc */
	global $manual_data,$page_data,$database;
	$query = "SELECT `page_ID` FROM `#__pages` WHERE `root_ID`='".$manual_data["root_ID"]."' AND `lft`<'".$page_data["lft"]."' AND `rgt`>'".$page_data["rgt"]."' ORDER BY `lft` DESC LIMIT 1";
	$database->setQuery($query);
	$temp = $database->loadRowAssoc();
	$parent_data = getPageLang($temp["page_ID"],$_GET["lang"]);
	
	$pages = get_pages_array($manual_data["root_ID"],$parent_data["page_ID"],$_GET["lang"],$page_data["page_ID"]);
	pmFrontendHTML::printSmalltoc($pages);
}

function printNotes($page_ID) {
	global $database;
	$table = new mlsDBTable("#__notes","note_ID",$database);
	$table->select(array("page_ID" => $page_ID),'time','desc');
	$notes = $table->_db->loadRowsAssoc();
	
	$page_data = getPageLang($page_ID,$_GET["lang"]);
	pmFrontendHTML::printNotes($notes,$page_data);
}

function displayPage($page_data) {
	$children = get_pages_array($page_data["root_ID"],$page_data["page_ID"],$_GET["lang"],0,FALSE);
	pmFrontendHTML::displayPage($page_data,$children);
}
?>
Return current item: Phpman