Monthly Archives: November 2010

How to manage menus in web pages

One of the reasons I started working with CSS was to get rid of my old Frames based web pages.  One of the main benefits of frames was that you could maintain your menus in a single file/frame and the information was valid for all content.  Unfortunately, just be implementing CSS this problem is not solved (although it is often written that CSS is a replacement for frames based web pages).

Thanks now to having been exposed to PHP, I have figured out the last piece of the puzzle… in PHP there are two functions… include() and require().  These two functions will take the  content from another page and place it into your web page.  Without knowing much else, these can be inserted in any page (renamed with a .PHP extension and made executable) and all of the static menu configuration from each page can be placed in the file you call.  This way, one can maintain the menu items in a single file and it will be valid for all content pages.  See the following tutorial for more information… PHP Includes.

Variable passing with require() and include()

Something new… variables are passed to require() and include() from the main page.  So based on the variable you set in the main page, you can return different pieces of code, menu items, etc.

In the main page you set the variable, call the file, and display the output.

<?php
$x=2;
require(“menu.php”);
echo $message;
?>

In the called file, evaluate the variable, set the output variable and return it to the main page.

<?php
if ($x==1)
$message=”Have a nice weekend!”;
else
$message=”Have a \”nice\” day!”;
return $message;
?>

Note that nested quotes need a \ preceeding them.  The code above would put… Have a “nice” day! … in the page.

The switch() function would probably make more sense if more than two or three values are expected.

IPv6 Tests

As my next experiment, I decided to build an IPv6 Lab to see if:

  1. I can get IPv6 running in an isolated environment
  2. I can get services running such as DNS and HTTP running over IPv6
  3. I can access the IPv6 services from IPv4 only hosts

After some work, mostly due to my lack of experience with installing BIND from scratch and learning how to configure Apache for IPv6, I finally got the following environment up and running:

(click on the diagram for a larger image)

As it turned out, I was also able to reach all of my goals.  For the most part, somethings were straight forward, others were not so straight forward. So that this post doesn’t get too long I will list the steps I took and the configurations I used in individual posts.