...

View Full Version : Menu formatting Help



emmieros
11-04-2009, 10:04 AM
Hi all, I was hoping you could point me in the right direction.
I'm building a very simple brochure site for the clinic I work at and wanted to put in a PHP include menu so that I can just update the one file.

I read an article about using PHP on a menu and kinda copied the code. My HTML and CSS are OK but my PHP is very very basic.

Only problem is now that I have the code in the menu doesn't format the way I expected - a list. It seems to run on. So I am assuming the problem lies in my CSS rather then my PHP but I could be wrong.

dummy page: http://www.thebodyworksclinic.com/new/Oct09/index.php

The code for the menu:


<ul>
<li <?php if ($thisPage=="Home")
echo " id=\"currentpage\""; ?>>
<a href="#">Home</a></li>
<li <?php if ($thisPage=="Estelle Mitchell")
echo " id=\"currentpage\""; ?>>
<a href="#">Estelle Mitchell</a></li>
<li<?php if ($thisPage=="Magnetic Resonance Therapy")
echo " id=\"currentpage\""; ?>>
<a href="#">Magnetic Resonance<br /> Therapy</a></li>
<li<?php if ($thisPage=="Specialist Knee Clinic")
echo " id=\"currentpage\""; ?>>
<a href="#">Specialist Knee<br> Clinic</a></li>
<li<?php if ($thisPage=="Electro-Lymphatic Drainage")
echo " id=\"currentpage\""; ?>>
<a href="#">Electro-Lymphatic Drainage</a></li>
<li<?php if ($thisPage=="Thermal Breast Screening")
echo " id=\"currentpage\""; ?>>
<a href="#">Thermal Breast Screening</a></li>
<li<?php if ($thisPage=="Gait Analysis")
echo " id=\"currentpage\""; ?>>
<a href="#">Gait Analysis</a></li>
<li<?php if ($thisPage=="Sports Massage")
echo " id=\"currentpage\""; ?>>
<a href="#">Sports Massage</a></li>
<li<?php if ($thisPage=="Nutrition and Wellness")
echo " id=\"currentpage\""; ?>>
<a href="#">Nutrition and Wellness</a></li>
<li<?php if ($thisPage=="Classes")
echo " id=\"currentpage\""; ?>>
<a href="#">Classes</a></li> <li<?php if ($thisPage=="We Recommend")
echo " id=\"currentpage\""; ?>>
<a href="#">We Recommend</a></li>
<li<?php if ($thisPage=="News")
echo " id=\"currentpage\""; ?>>
<a href="#">News</a></li>
<li<?php if ($thisPage=="Where we are")
echo " id=\"currentpage\""; ?>>
<a href="#">Where we are</a></li>
</ul>


The relevant code from the CSS:


#navBar{
padding: 0px;
background-color:#FFFFFF;
border-right: 2px solid #107a67;
border-bottom: 2px solid #107a67;
width:20%;
float:left;
}
#navbar ul {
list-style: none;
list-style-position:outer;
margin: 0;
padding: 0;
}

#navbar li {
background: #FFFFFF;
border-right: 1px solid #107a67;
float: left;
margin: 0;
padding: 0;
}

#navbar a {
color: #107a67;
font-weight: bold;
padding: 5px 10px;
text-decoration: none;
}

#navbar a:hover {
color: #107a67;
}

#navbar #currentpage a {
background: #fff;
color: #107a67;
}


Any and all help much appreciated!

abduraooft
11-04-2009, 01:12 PM
Only problem is now that I have the code in the menu doesn't format the way I expected - a list. It seems to run on. Sorry, that's not clear. How would you like to get the display?

btw, your markup has some errors in it, see http://validator.w3.org/check?uri=http%3A%2F%2Fwww.thebodyworksclinic.com%2Fnew%2FOct09%2Findex.php&charset=%28detect+automatically%29&doctype=Inline&group=0
I'd recommend to fix them first.


<div id="navBar">
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"> If you are including an external page to output the menu, you don't need to have a complete HTML structure in your menu page. Just that <ul>-<li> structure would be required there.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum