Stickybomb Posted March 5, 2007 Share Posted March 5, 2007 hi, i am having a problem with a very simple php nav is causeing roblems when viewed on a mac browser. here is the code for the nav <?php //Section is declared on php page that calls this file ?> <!--MAIN NAVIGATION--> <ul id="nav_Main"> <li><a href="/link1.php"<?php if ($section == "1") echo " class=\"current\"";?>>link1</a> <li><a href="/link2.php"<?php if ($section == "2") echo " class=\"current\"";?>>link2</a> <li><a href="/section3/link3.php"<?php if ($section == "3") echo " class=\"current\"";?>>link3</a> <?php if ($section == "3") { ?> <li class="sub"><a href="/section3/sub1.php">sub1</a> <li class="sub"><a href="/section3/sub2.php">sub2</a> <li class="sub"><a href="/section3/sub3.php">sub3</a> <?php } ?> <li><a href="/link4.php"<?php if ($section == "4") echo " class=\"current\"";?>>link4</a> <li><a href="home.php" target="_blank">home</a> </ul> ?> then i just declare a simple variable at the top of each page for the section that it is in. The problem is that for some reason when i go to one of he sub pages all of the links below the page that i am on do not function. that is to say that i can click and nothing happens, they do not even register as links. if anyone can help me with this it would be great. thks- -stickybomb- Quote Link to comment Share on other sites More sharing options...
Psycho Posted March 5, 2007 Share Posted March 5, 2007 Your problem is not PHP it is HTML and/or CSS. You need to look at the output that is generated and find out why is isn't rendered correctly in the MAC. My guess is that it would ahve something to do with the class "current" Quote Link to comment Share on other sites More sharing options...
Stickybomb Posted March 6, 2007 Author Share Posted March 6, 2007 how does css prevent links form functioning? here is the source code <ul id="nav_Main"> <li><a href="/link1.php">link1</a> <li><a href="/link2.php">link2</a> <li><a href="/section3/link3.php" class="current">link3</a> <li class="sub"><a href="/section3/sub1.php">sub1</a> <li class="sub"><a href="/section3/sub2.php">sub2</a> <li class="sub"><a href="/section3/sub3.php">sub3</a> <li><a href="/link4">link4</a> <li><a href="home.php" target="_blank">home</a> </ul> i cant see any reason y the sub links would not be links according to this, but when i try to click them its as if they were text and as for the css these are the classes referenced #nav_Main { text-align: right; padding-top: 13px; z-index: 5; width: 175px; float: left } #nav_Main li { list-style-type: none; padding-bottom: 3px } #nav_Main a {text-decoration: none;} #nav_Main li.sub { margin-top: 0; margin-bottom: 0; padding-top: 0; padding-bottom: 2px } #nav_Main li.sub a {color:#000; font-size: 8pt;} a.current {font-weight: bold; color: #000} Quote Link to comment Share on other sites More sharing options...
Psycho Posted March 6, 2007 Share Posted March 6, 2007 how does css prevent links form functioning? Well, it can, but is sure as heck isn't the PHP that is causing the problem. The PHP is only delivring the HTML to the browser. It has absolutely NO control over how the browser renders the page. However, your problem is neither PHP nor CSS. It is just basic HTML. Plus, you r problem is not just on the MAC. The code you have above also does not work in FF or Opera. Just a tip, but you should never test your pages in IE. Internet Explorer is very forgiving of errors and will "correct" bad code. So, pages that display in IE may not display in other browsers. In any event, your problem is that you preface all of your links with a forward slash - remove it. Quote Link to comment Share on other sites More sharing options...
Stickybomb Posted March 6, 2007 Author Share Posted March 6, 2007 im not tesing my script in internet explorer im on a mac using firefox and safari, i just thought this was rather wierd since it works fine on ie and the only problem is with the sub menu but thanks anyway Quote Link to comment Share on other sites More sharing options...
Psycho Posted March 7, 2007 Share Posted March 7, 2007 Sorry, I misread something previously. BUt I think the problem is still as I described. Have you tried removing the leading slashes? Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.