menu or anything else you like to suggest me .
And
any other logic usully professional follow to make
dynamic menu paths/
config.php
<?php
//echo $docroot = $_SERVER['DOCUMENT_ROOT'].'<br>';
//echo __FILE__;
$docroot = $_SERVER['PHP_SELF'];
//$docroot = $_SERVER['DOCUMENT_ROOT'];
//$docroot = __FILE__;
$curPage = $PHP_SELF;
$curPage = path_get_last_arg($curPage);
$docroot = str_replace("\\","/",$docroot);
$docroot = str_replace($curPage,"",$docroot);
function path_get_last_arg($path){
$path = str_replace('\\', '/', $path);
$path = preg_replace('/\/+$/', '', $path);
$path = explode('/', $path);
$l = count($path)-1;
return isset($path[$l]) ? $path[$l] : '';
}
?>
menu.php
<?php require_once('config.php'); ?>
<table width="200" border="1">
<tr>
<td align="center"><h4> MENU </h4></td>
</tr>
<tr>
<td><a href="<?php echo $docroot; ?>link1.php">link1</a></td>
</tr>
<tr>
<td><a href="<?php echo $docroot; ?>link2.php">link1</a></td>
</tr>
<tr>
<td><a href="<?php echo $docroot; ?>link3.php">link1</a></td>
</tr>
</table>
template.php
<style>
.abc {
border: thin dotted #CCFF99;
color: #FF0066;
}
</style>
<table width="750" height="750" border="1" class="abc">
<tr>
<td colspan="3" align="center" height="80">header</td>
</tr>
<tr>
<td width="150" valign="top"><?php require_once('menu.php'); ?></td>
<td width="600"><?php echo $contents; ?> </td>
</tr>
<tr>
<td colspan="3" height="80" align="center">footer</td>
</tr>
</table>
link1.php
<?php
$contents='link1';
require_once('template.php');
?>
link3.php
<?php
$contents='link2';
require_once('template.php');
?>
same as
<?php
$contents='link3';
require_once('template.php');
?>
This post has been edited by William_Wilson: 29 September 2008 - 06:59 PM

New Topic/Question
Reply



MultiQuote







|