Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    New to the CF scene
    Join Date
    Apr 2009
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Menu formatting Help

    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:
    PHP Code:
    <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:
    Code:
    #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!

  • #2
    Supreme Master coder! abduraooft's Avatar
    Join Date
    Mar 2007
    Location
    N/A
    Posts
    14,849
    Thanks
    160
    Thanked 2,223 Times in 2,210 Posts
    Blog Entries
    1
    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=ht...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.
    Last edited by abduraooft; 11-04-2009 at 01:15 PM.
    The Dream is not what you see in sleep; Dream is the thing which doesn't let you sleep. --(Dr. APJ. Abdul Kalam)


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •