mrjoaopereira Posted January 18, 2010 Share Posted January 18, 2010 <ul id="navigation"> <li <?php if ($page=='index.php') echo 'class=aktiv'?> ><a href="index.php">home</a></li> <li class="trenner">/</li> <li <?php if ($page=='gallery.php') echo 'class=aktiv'?> ><a href="gallery.php">gallery</a></li> <li class="trenner">/</li> <li <?php if ($page=='portfolio.php') echo 'class=aktiv'?> ><a href="portfolio.php">portfolio</a></li> <li class="trenner">/</li> <li <?php if ($page=='about.php') echo 'class=aktiv'?> ><a href="about.php">about</a></li> <li class="trenner">/</li> <li <?php if ($page=='contact.php') echo 'class=aktiv'?> ><a href="contact.php">contact</a></li> </ul> Followed by: <?php $page ="index.php"; include("includes/header.php"); ?> on the source stopped working and i cant figure it out. possible to get some help i get this error on validating : Error Line 18, Column 13: an attribute value specification must be an attribute value literal unless SHORTTAG YES is specified <li class=aktiv ><a href="index.php">home</a></li> being a sort of a noobie i cant figure it out... ty, joao Quote Link to comment https://forums.phpfreaks.com/topic/188876-navigation-menu/ Share on other sites More sharing options...
oni-kun Posted January 18, 2010 Share Posted January 18, 2010 Add the following code at the top of your page right after the <?php element, and see if it reports any errors: ini_set('display_errors',1); error_reporting(E_ALL); What error are you exactly getting, is that all your code? What are you expecting to get? You're not giving us a lot to work with. Quote Link to comment https://forums.phpfreaks.com/topic/188876-navigation-menu/#findComment-997209 Share on other sites More sharing options...
mrjoaopereira Posted January 18, 2010 Author Share Posted January 18, 2010 i dont get any errors... i do get the error i updated above on validating the page on http://validator.w3.org Error Line 18, Column 13: an attribute value specification must be an attribute value literal unless SHORTTAG YES is specified <li class=aktiv ><a href="index.php">home</a></li> erm... if the php is right why doesnt it work? Here goes full code: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <title>Joao Paulo Vieira Pereira</title> <meta http-equiv="content-type" content="text/html;charset=utf-8"/> <meta name="keywords" content="Joao Pereira, Personal Website"/> <link rel="stylesheet" href="css/style.css" type="text/css"/ </head> <body> <div id="background"> </div> <div id="page-wrapper"> <div id="content-wrapper" class="clearfix"> <div id="header"> <ul id="navigation"> <li <?php if ($page=='index.php') echo 'class=aktiv'?> ><a href="index.php">home</a></li> <li class="trenner">/</li> <li <?php if ($page=='gallery.php') echo 'class=aktiv'?> ><a href="gallery.php">gallery</a></li> <li class="trenner">/</li> <li <?php if ($page=='portfolio.php') echo 'class=aktiv'?> ><a href="portfolio.php">portfolio</a></li> <li class="trenner">/</li> <li <?php if ($page=='about.php') echo 'class=aktiv'?> ><a href="about.php">about</a></li> <li class="trenner">/</li> <li <?php if ($page=='contact.php') echo 'class=aktiv'?> ><a href="contact.php">contact</a></li> </ul> <h1><span class="bauhaus gray-222 mega bold">Joao Pereira</span></h1> </div> this is for my header include. the php is minimum but i am learning that is the way right? Quote Link to comment https://forums.phpfreaks.com/topic/188876-navigation-menu/#findComment-997218 Share on other sites More sharing options...
deansatch Posted January 18, 2010 Share Posted January 18, 2010 add a semi-colon to the end of each of your echo statements: <?php if ($page=='about.php') echo 'class=aktiv'; ?> Quote Link to comment https://forums.phpfreaks.com/topic/188876-navigation-menu/#findComment-997226 Share on other sites More sharing options...
oni-kun Posted January 18, 2010 Share Posted January 18, 2010 i dont get any errors... i do get the error i updated above on validating the page on http://validator.w3.org Error Line 18, Column 13: an attribute value specification must be an attribute value literal unless SHORTTAG YES is specified <li class=aktiv ><a href="index.php">home</a></li> erm... if the php is right why doesnt it work? Just a note, the validator does not do anything to the php, nor does it tell you of any errors, just html stuff. And yes, upon looking at your code the IF statements are incorrect, they should be: <?php $page ="index.php"; include("includes/header.php"); ?> <ul id="navigation"> <li <?php if ($page=='index.php') { echo 'class=aktiv'; }?> ><a href="index.php">home</a></li> <li class="trenner">/</li> <li <?php if ($page=='gallery.php') { echo 'class=aktiv'; } ?> ><a href="gallery.php">gallery</a></li> <li class="trenner">/</li> <li <?php if ($page=='portfolio.php') { echo 'class=aktiv'; } ?> ><a href="portfolio.php">portfolio</a></li> <li class="trenner">/</li> <li <?php if ($page=='about.php') { echo 'class=aktiv'; } ?> ><a href="about.php">about</a></li> <li class="trenner">/</li> <li <?php if ($page=='contact.php') { echo 'class=aktiv'; }?> ><a href="contact.php">contact</a></li> </ul> .. PHP error reporting would tell you this. Quote Link to comment https://forums.phpfreaks.com/topic/188876-navigation-menu/#findComment-997229 Share on other sites More sharing options...
deansatch Posted January 18, 2010 Share Posted January 18, 2010 And for it to validate the html - add the quotes on each attribute value: <li <?php if ($page=='contact.php') { echo 'class="aktiv"'; }?> ><a href="contact.php">contact</a></li> Quote Link to comment https://forums.phpfreaks.com/topic/188876-navigation-menu/#findComment-997232 Share on other sites More sharing options...
mrjoaopereira Posted January 18, 2010 Author Share Posted January 18, 2010 problems with the validation were fixed, ty so much for helping a newbie as for the php it doesnt work and it seems correct... i almost feel bad about insisting Quote Link to comment https://forums.phpfreaks.com/topic/188876-navigation-menu/#findComment-997237 Share on other sites More sharing options...
bullbreed Posted January 18, 2010 Share Posted January 18, 2010 What does the AKTIV class do. Is it just so show that the link is active? Quote Link to comment https://forums.phpfreaks.com/topic/188876-navigation-menu/#findComment-997240 Share on other sites More sharing options...
mrjoaopereira Posted January 18, 2010 Author Share Posted January 18, 2010 #header #navigation li a.aktiv { color:#000; font-family:Arial, Helvetica, sans-serif; font-size: 25px; cursor: default; } thats my css for the class it does make a diference, but in any case im just bugged why i cant make it work css correct, xhtml correct, php seems correct yet it doesnt work, aha!! if u wanna check if for some reason it doesnt work only for me www.ojoao.com its under construction so most of the links arent working but you should see the home page Quote Link to comment https://forums.phpfreaks.com/topic/188876-navigation-menu/#findComment-997243 Share on other sites More sharing options...
deansatch Posted January 18, 2010 Share Posted January 18, 2010 Just from looking at how you explained in your original post, it looks like you are declaring the $page variable after the navigation so the if statements will be seeing $page = ''; - add $page = 'index.php'; BEFORE your nav. Quote Link to comment https://forums.phpfreaks.com/topic/188876-navigation-menu/#findComment-997247 Share on other sites More sharing options...
mrjoaopereira Posted January 18, 2010 Author Share Posted January 18, 2010 no no! the source starts with : <?php $page="index.php"; include("includes/header.php"); ?> the navigation coding you see in the include file. im going to leave it as it is though without the class as i am getting late to present this site done on wed... Quote Link to comment https://forums.phpfreaks.com/topic/188876-navigation-menu/#findComment-997254 Share on other sites More sharing options...
oni-kun Posted January 18, 2010 Share Posted January 18, 2010 no no! the source starts with : <?php $page="index.php"; include("includes/header.php"); ?> the navigation coding you see in the include file. im going to leave it as it is though without the class as i am getting late to present this site done on wed... From looking at the source, it appears index.php has the 'active' class on, You'd need to make those other links if you want to test if the other ones work, because from what I can see, your code is solid. Quote Link to comment https://forums.phpfreaks.com/topic/188876-navigation-menu/#findComment-997256 Share on other sites More sharing options...
bullbreed Posted January 18, 2010 Share Posted January 18, 2010 You dont need PHP to style your aktive links you can do it all through css Just define a class for the active page .page { padding: 5px 9px 5px 9px; color: #999; font-family: 'Century Gothic'; font-weight: normal; text-decoration: none; background-color: #141414; border: solid #990000 2px; -moz-border-radius: 5px; -webkit-border-radius: 5px; border-radius: 5px; } Then just ad a span to it like this <li><a href="index.html"><span class="page">HOME</span></a></li> Id your menu dynamically driven? Quote Link to comment https://forums.phpfreaks.com/topic/188876-navigation-menu/#findComment-997264 Share on other sites More sharing options...
deansatch Posted January 18, 2010 Share Posted January 18, 2010 The problem is your css Change: #header #navigation li a.aktiv To: #header #navigation li.aktiv a Quote Link to comment https://forums.phpfreaks.com/topic/188876-navigation-menu/#findComment-997265 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.