View Single Post
Old 03-08-2006, 04:25 AM   #8 (permalink)
DJMaze
Senior Contributor
 
DJMaze's Avatar
 
Join Date: Mar 2005
Posts: 676
DJMaze is on a distinguished road
Here's another way

index.php
PHP Code:
<html>
<body>
<table>
<tr>
<!-- start side navigation
  <td>
    <a href="index.php?recipe=1">link 1</a><br/>
    <a href="index.php?recipe=2">link 2</a><br/>
    <a href="index.php?recipe=3">link 3</a><br/>
  </td>
  <td>
<?php
// Start the dynamic content/recipes

if (isset($_GET['recipe']) && preg_match('#[a-z0-9_]#i'$_GET['recipe'])) {
  
// cool the visitor wants to see my recipe
  
$recipe 'recipes/'.$_GET['recipe'].'.html';
  if (
is_file($recipe)) {
    
// the requested recipe exists
    
include($recipe);
  } else {
    
// the recipe does not exist
    
include('no_recipe.html');
  }
} else {
    include(
'index.html');
}
?>
  </td>
</tr>
</table>
</body>
</html>
Now you write your recipes inside the 'recipes' folder just like any other html file, BUT without the <html><body> part.
DJMaze is offline   Reply With Quote