Sample Menu Data

Source Code

The format for the Menu and Page data is listed in a Comma Seperated Value (csv) file as below. The default filename used by the sidebar creation script is "menu_data.txt". This same file is also used by the Menu Handler to create an array of valid page references. If the page name is not included in this list, the page handling script foreces the first page on the list to become the output page. Similarly, as a security measure, if the user modifies the Query string, the first (default) page is displayed.

Label for the Link , Class for the Link , php Query string , Text for the Alt = , Text for the Title=
  Pages ~,sbhead1,header,,  
Index, link,?page=index,Index Page here,Index Alternate Text here
Page One,link,?page=one,Page One Title,Page One Alternate Text here 
Page Two,link,?page=two,Page Two Title,Page Two Alternate Text here 
Page Three,link,?page=three,Page Three Title,Page Three Alternate Text here 
Page Four,link,?page=four,Page Four Title,Page Four Alternate Text here 
, , footer,,  
~  Forums  ~,sbhead2, header,,  
Trap17,link1,\http://www.trap17.com,Trap17 Forum and Hosting,
Trap17 Forum and Hosting
PC Pit Stop,link1,\http://www.pcpitstop.com,PC Pit Stop Forum,PC Pit Stop Forum
CSS Creator,link1,\http://www.csscreator.com,CSS Creator,CSS Creator 
PC How to's,link1,\http://www.pchowtos.co.uk,PC How To Forum,PC How To Forum
Astahost,link1,\http://www.astahost.com/,Astahost Forum,Astahost Forum  
, , footer,, 
"& nbsp ;",sbhead1,header,,  

How It Works

Forcing a Menu Header

This line:

~  Pages ~,sbhead1,header,,
is used to begin a Menu Section.

Forcing a Menu Footer

This line:

, , footer,,
is used to end a Menu Section.

Ending a Menu

This line:

"& nbsp ;",sbhead1,header,,
is used to end a Menu. The non-breaking space is required to give some content otherwise it doesn't display correctly. Be sure to remove the quotes and spaces so it is a valid html non-breaking space character. It had to be modified for display in this presentation.

Spaces are acceptable around the Query String because the Script 'trims' the 'whitespace' from it. There is no 'trim' performed on the rest of the data. I couldn't see the purpose for it. The only other place you may want to 'trim' is the link name, but it seems to handle whitespace okay by itself.

Previous page:

Check Your Data

There is an additional script included in the Zip file named "csv_check.php" which reads the "menu_data.txt" file and prints out the details for each line of the Menu using two formats. Run this script to check the data in the file.

Each script included in the Template.zip file defaults to this file for the source of the menu/sidebar links, etcetera, but the referenced file can be changed. Simply modify the php scripts in your text editor and save them as the originally named scripts, however, "if it ain't broke, don't fix it".

One short warning, if the data file for the menu information is inspected or modified using your text editor, be sure to save the file without word-wrap, or else the menu script mis-behaves because it assumes the cr/lf which is mid-way in the data line actually ends the first line and starts a new one, which, of course, is not correct.

Previous Page : The Content Array Script Next Page: The Contact Form page