Location: PHPKode > projects > chillyCMS > chillyCMS/admin/internallink.include.php
<?php
//#################################################################################################
//	Insert internal links into content helper functions
//#################################################################################################
//	chillyCMS - Content Management System
//	Copyright (C) 2008
//	Stefanie Wiegand <hide@address.com> & Johannes Cox <hide@address.com>
//	
//	This program is licensed under the GPL 3.0 license. For more information see LICENSE.txt.
//#################################################################################################
//	show_links()
//#################################################################################################
defined('DOIT') or die('Restricted access');

//Show links to all items /////////////////////////////////////////////////////////////////////////
function show_links() {
	global $l_edit,$page;
	//get all menus
	$page->query("select id from site_content where parentid=0");
	$result = $page->db->getdata_array();

	$links = "<div class='popup'>".
	"<br /><h3 class='center'>$l_edit[lbl_intlink]</h3><a class=\"info\" title=\"".$l_edit["lbl_howto"]."\"></a><br />";
	//build each menu
	foreach ($result as $tree) {
		$menuitems = get_tree($tree["id"],"list");
		$links .= "<br><table style='margin: 0 auto;' cellspacing='0'>";
		$style="odd";
		//make links for each item
		foreach ($menuitems as $mi) {
			$mi->name	= escape_html($mi->name);
			$mi->id		= intval($mi->id);
			
			//make name short enough not to destroy the layout
			$name_short = $mi->name;
			if (strlen($name_short)>=25) { $name_short = substr($name_short,0,22).'...'; }
			
			if ($mi->depth>0) {
				$address = URL."/index.php?id=";
				$links .= "<tr class='$style'><td width='200'>
				<a href='".$address.$mi->id."' title=\"".$mi->name."\">".$name_short."</a></td></tr>";
			} else {
				$links .= "<tr class='$style'><th class='center' width='200'>".$mi->name."</th></tr>";
			}
			if ($style=="odd") { $style="even"; } else { $style="odd"; }
		}
		$links .= "</table>";
	}
	$links .= "</div>";
	
	return $links;
}
?>
Return current item: chillyCMS