Jump to content

simple PHP nav help on MAC OSX


Stickybomb

Recommended Posts

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-

Link to comment
https://forums.phpfreaks.com/topic/41331-simple-php-nav-help-on-mac-osx/
Share on other sites

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}

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.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.