PDA

View Full Version : CSS submenu's not working with embeded PHP


thedon
03-03-2010, 08:33 AM
hi,
I have changed my website to end in php and now have prblems with my left navigation sub menu's, When I hover over "About Thailand" on the following link http://www.thai-discovery.com/phuket-Thailand.php (http://www.thai-discovery.com/phuket-Thailand.php)

I coped all of the li tags as follows and saved them onto a leftnav.php file

<li> <a href="#" class="vertmenu"><img src="http://www.webmaster-talk.com/images/sub menu button.png" width="12" height="8" align="right" border="none"/>About Thailand</a>
<ul>
<li><a class="vertmenu" href="Thaimonarchy.html">Thai Monarchy</a></li>
<li><a class="vertmenu" href="Thai-history.php">Thai History</a></li>
<li><a class="vertmenu" href="thai-culture.php">Thai Culture</a></li>
<li><a class="vertmenu" href="Thai-cuisine.php">Thai Cuisine</a></li>
</ul>
</li>
<li><a href="tips.php" class="vertmenu">Travel Tips</a></li>
<li> <a class="vertmenu" href="dosanddonts.php">Do's and Don'ts</a></li>
<li> <a href="#" class="MenuBarItemSubmenu vertmenu"><img src="http://www.webmaster-talk.com/images/sub menu button.png" width="12" height="8" align="right" border="none"/>Shopping</a>
<ul>
<li><a href="#" class="MenuBarItemSubmenu vertmenu"><img src="http://www.webmaster-talk.com/images/sub menu button.png" width="12" height="8" align="right" border="none" />Bangkok</a>
<ul>
<li><a class="vertmenu" href="MBK-center-thailand.php">MBK Center</a></li>
<li><a href="emporium.php" class="vertmenu">Emporium</a></li>
<li><a class="vertmenu" href="pantip plaza.php">Pantip Plaza</a></li>
<li><a class="vertmenu" href="siam-square.php">Siam Square</a></li>
<li><a class="vertmenu" href="siam-paragon.php">Siam Paragon</a></li>
<li><a class="vertmenu" href="Siam-Center-bangkok.php">Siam Center</a></li>
<li><a class="vertmenu" href="Central-World.php">Central World</a></li>
<li><a class="vertmenu" href="Suan-lum-Night-bazaar.php">Suan Lum </a></li>
<li><a class="vertmenu" href="Chatuchak-markets.php">JJ Markets</a></li>
</ul>
</li>
<li><a href="#" class="vertmenu MenuBarItemSubmenu"><img src="http://www.webmaster-talk.com/images/sub menu button.png" width="12" height="8" align="right" border="none" />Pattaya</a>
<ul>
<li><a href="Pattaya-Beach-Markets.php" class="vertmenu">Pattaya Markets</a></li>
<li><a href="Royal-Garden-Plaza.php" class="vertmenu">Royal Garden</a></li>
<li><a href="Central-Group.php" class="vertmenu">Central-Pattaya</a></li>
</ul>
</li>
<li><a href="#" class="vertmenu MenuBarItemSubmenu"><img src="http://www.webmaster-talk.com/images/sub menu button.png" width="12" height="8" align="right" border="none" />Phuket</a>
<ul>
<li> <a href="Patong-Beach-road-markets.php" class="vertmenu">Patong Markets</a></li>
<li> <a href="Jungceylon-Shopping-Complex.php" class="vertmenu">Jungceylon</a></li>
<li> <a href="Central-Group.php" class="vertmenu">Central-Phuket</a></li>
</ul>
</li>
<li><a href="#" class="vertmenu MenuBarItemSubmenu"><img src="http://www.webmaster-talk.com/images/sub menu button.png" width="12" height="8" align="right" border="none" />Chiang Mai</a>
<ul>
<li><a href="Chiang-Mai-Night-Bazaar.php" class="vertmenu">CM Night Bazaar</a></li>
<li><a href="Central-Group.php" class="vertmenu">Central-Chiang Mai</a></li>
</ul>
</li>
<li><a href="#" class="vertmenu MenuBarItemSubmenu"><img src="http://www.webmaster-talk.com/images/sub menu button.png" width="12" height="8" align="right" border="none" />Koh Samui</a>
<ul>
<li><a href="Chaweng-Shopping.php" class="vertmenu">Chaweng</a></li>
</ul>
</li>
<li><a href="#" class="vertmenu MenuBarItemSubmenu"><img src="http://www.webmaster-talk.com/images/sub menu button.png" width="12" height="8" align="right" border="none" />Koh Chang</a>
<ul>
<li><a href="Koh-Chang-Shopping.php" class="vertmenu">General Shopping</a></li>
</ul>
</li>
<li><a href="#" class="vertmenu MenuBarItemSubmenu"><img src="http://www.webmaster-talk.com/images/sub menu button.png" width="12" height="8" align="right" border="none" />Hua Hin</a>
<ul>
<li><a href="Hua-Hin-Village-Market.php" class="vertmenu">Village Market</a></li>
<li><a href="HuaHin-Night-Market.php" class="vertmenu">Night Market</a></li>
</ul>
</li>
</ul>
</li>
<li> <a class="vertmenu" href="visainfo.php">Visa Info</a></li>
<li> <a class="vertmenu MenuBarItemSubmenu" href="#"><img src="http://www.webmaster-talk.com/images/sub menu button.png" width="12" height="8" align="right" border="none" />Visa Runs</a>
<ul>
<li><a href="../Laos-visa-run.php"class="vertmenu">Laos Visa Run</a></li>
<li><a href="../Cambodia-visa-run.php"class="vertmenu">Cambodia Visa Run</a></li>
<li><a href="../border-checkpoints.php"class="vertmenu">Border Checkpoints</a></li>
</ul>
</li>
<li> <a class="vertmenu" href="weather.php">Weather</a></li>
<li> <a class="vertmenu" href="public-holidays-Thailand.php">Public Holidays</a></li>
<li> <a class="vertmenu" href="thai-maps.php">Map of Thailand</a></li>
<li> <a class="vertmenu" href="embassy.php">Embassy List</a></li>
<li> <a class="vertmenu MenuBarItemSubmenu" href="#"><img src="http://www.webmaster-talk.com/images/sub menu button.png" width="12" height="8" align="right" border="none"/>Thai Transport</a>
<ul>
<li><a class="vertmenu" href="Taxi-thailand.php">Taxi's</a></li>
<li><a class="vertmenu" href="Bus.php">BKK Buses</a></li>
<li><a class="vertmenu" href="buses-around-thailand.php">Long Haul buses</a></li>
<li><a class="vertmenu" href="trains.php">Trains</a></li>
<li><a class="vertmenu" href="Boat-thailand.php">BKK Boats</a></li>
</ul>
</li>
<li> <a class="vertmenu" href="moving-to-Thailand.php">Moving Here</a></li>
<li> <a href="Useful-Numbers-thailand.php" class="vertmenu">Useful Numbers</a></li>
<li><a href="Links.php" class="vertmenu">Links</a></li>
<li><a href="Contactus.php" class="vertmenu">Contact Us</a></li>
<li> <a class="vertmenu" href="advertise.php">Advertise</a></li>

I replaced the above code with

<?php include_once ('incl/leftnav.php'); ?>

So why would my nav sub menu's suddenly stop working?

DWcourse
03-03-2010, 01:03 PM
When you place a menu in an include file it's best to use root-relative links so they work anywhere in your site. So, the links should start with / and look like (assuming most of your files are in your root folder):

href="/Thaimonarchy.html"
href="/Thai-history.php"

etc.