hey folks, here i made a menu. now i want some fields to be child of main menu like under about me section there are 4 links, which i want to intend. and which is currently active should have class of id current. i have made it so far but i don’t know how to apply style to submenu of main menu. can i get some help? here is my code with css
<html>
<head>
<title>Menu</title>
<style type="text/css">
ul parent, ul child{margin:0}
.parent li{margin-bottom:5px; list-style:none; text-decoration:none; color:maroon;}
.child li{margin-left:10px;list-style:none;}/*sub menu of main menu*/
.child li a#current{color:pink;}/*the active link will have this class*/
</style>
</head>
<body>
<?php
$menu = array('Home',
'about.php'=>'About me',
'studio.php'=>'Photo Studio',
'web.php'=>'Web Designing',
'arts.php'=>'Visual Arts',
'logo.php'=>'Logo Designing',
'#'=>'Contact',
'facebook.php'=>'Facebook',
'twitter.php'=>'Twitter',
'linkdIn.php'=>'LinkdIn');
?>
<ul class="parent">
<?php
foreach($menu as $menupointer => $newlink){
echo "<a href=\\"$menupointer\\"><li>$newlink</li></a>";
}
?>
</ul>
also i have a problem, when i give same url or hash to a menu name. it disappear. i think its unique and only latter one is picked. how can i fix that. as i don't want any link on parent which have sub menu.
thanks in advance
</body>
</html>
The substr function moves the pointer ahead one spot as $_SERVER[‘PHP_SELF’] keeps the forward slash / at the beginning of the string. Hope that explains it bud
Browsers that need the contents of style or script tags to be surrounded by comment text to not accidentally display them are no longer in use by anyone sane. Indeed, I haven’t used that kind of markup since 1997 or so.
Unless you structure the array the way i did the array wont work, it needs the values to be in the order i set them to
Browsers that need the contents of style or script tags to be surrounded by comment text to not accidentally display them are no longer in use by anyone sane. Indeed, I haven’t used that kind of markup since 1997 or so.
Force of habit, i only ever do it so i can read the CSS
the bold line has the error. here i couldn’t make a good css style to demonstrate but still, it tell wh’s wrong with php
edit: also there is another problem like in this example i have two main headings. which i don’t wanna give a link for coz its just a parent o child links. if i give it # both times. only the preceding will work.
Sorry about before post. i forgot the edit the arrays to make them like u told me, its still not printing anything on screen. i seen the source code and here it is
<html>
<head>
<title></title>
<style type="text/css">
ul li parent{color:#000;}
</style>
</head>
<body>
<li class="parent"><a href="Array"></a></li><li class="parent"><a href="Array"></a></li></body>
</html>
thanks SL, sorry that codes just got me confused. though a little problem left. the links i am currently active on has different class/color. now what happen is when i give