Jump to content

Css Menu, No Longer Working?


taaron12
 Share

Recommended Posts

Hi guys. I've decided to switch my menu links from text into images by using the img src links. I've got all my imgs linked, and displayed, but when the options no longer drop down, with an exception of the first one. I'm unsure what I've done wrong. Not to mention, the imgs are being cut off by the CSS width. Any idea where I've goofed, and how to fix? :)http://scratch.taaron.org/Btw, I'm also interested in making the update boxes(which will show the most recent updates) clickable to where they'll expand into the big open white space, showing a back log of updates. which section should I look into for information on that? Thanks!

Edited by taaron12
Link to comment
Share on other sites

You have a lot of document type decelerations in the code and <head>, <body> tags you only need one of these. That might be the start of your problem.

Link to comment
Share on other sites

You have a lot of document type decelerations in the code and <head>, <body> tags you only need one of these. That might be the start of your problem.
Thanks. I wonder if that might be caused from using <?php include... ? So, it'd be safe to remove the header and body tags off the php files?
Link to comment
Share on other sites

Thanks. I wonder if that might be caused from using <?php include... ? So, it'd be safe to remove the header and body tags off the php files?
If you remove the tags from the php script output then they won't be in your html when the script executes. Post your php script, im sure your using includes where you could use echo.Echo output is more specific than including whole files eg.
<?php echo"Hello World!; ?>

instead of

include"helloworld.html";

Link to comment
Share on other sites

yeah, but he was asking for your PHP code itself. i.e. the contents of menu.php. I think he was implying that perhaps there are PHP statements/outputs which could be causing potential problems, like the fact the you have a doctype within menu.php which would give your parent page two doctypes, which is not a good thing.

Link to comment
Share on other sites

Oh, I see. Sorry. :) <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8" /><title>Menu</title></head> <ul> <div id = "taaron.button" > <li><a href = "http://www.taaron.org"> <img src="shared/menu/taaron.png" alt="Taaron.org"/> <ul> <li><a href = "http://www.taaron.org/contact/">Contact</a></li> <li><a href = "http://www.taaron.org/links/">links</a></li> </ul></li> </div> <div id = "blog.button"> <li><a href = "http://blog.taaron.org"> <img src="shared/menu/blog.png" alt="Blog"/> <ul> </ul></li> </div> <div id = "projects.button"> <li><a href = "http://projects.taaron.org"> <img src="shared/menu/projects.png" alt="Projects"/> <ul> <li>Flash</li> <li>Written</li> <li>Customized Toys</li> </ul></li> </div> <div id = "gallery.button"> <li><a href = "http://gallery.taaron.org"> <img src="shared/menu/gallery.png" alt="Gallery"/> <ul> <li>Art</li> <li>Photo</li> </ul></li> </div> <div id = "reviews.button"> <li><a href = "http://reviews.taaron.org"> <img src="shared/menu/reviews.png" alt="Reviews"/> <ul> <li>Food</li> <li>Toys</li> <li>Books, CDs, DVDs & Games</li> </ul></li> </div> <div id = "collection.button"> <li><a href = "http://collection.taaron.org"> <img src="shared/menu/collection.png" alt="Collection"/> <ul> <li>Transformers</li> <li>Gundam</li> <li>Lego</li> <li>Books, CDs, DVDs & Games</li> </ul></li> </div> <div id = "Search"> <form action="http://www.google.com/cse" id="cse-search-box" target="_blank"> <div> <input type="hidden" name="cx" value="partner-pub-2344841484960553:ezeiysfp62i" /> <input type="hidden" name="ie" value="ISO-8859-1" /> <input type="text" name="q" size="31" /> <input type="submit" name="sa" value="Search" /> </div></form><script type="text/javascript" src="http://www.google.com/coop/cse/brand?form=cse-search-box&lang=en"></script> </div></div><body></body></html>

Edited by taaron12
Link to comment
Share on other sites

why did you save it as a .php file if there's no php code in it?basically, you exclude everything other than what you actually are trying to include. basically, start with that container div and end with its closing tag, and its content should be your menu code.

Link to comment
Share on other sites

Thanks. :) As for saving it to php, I was having problems focusing on huge sections of code, so somebody suggested I write them seperately as .php files, and then use the include command to get them to display. I recalled seeing a few websites displaying their pages as .php before, so I guess it made sense to me. :) :)I suppose I should return to the text links, instead of the image links, as the drop down WAS working before I added the images..

Edited by taaron12
Link to comment
Share on other sites

well, i don't think the file extension itself actually determines anything relating to the page, as a page has headers which tell a program what to do with its content. But, in their case they might have had php code in there so it would make since to save it as a php page. No one would ever know because you'll never the php code itself displayed in browser or the page source when viewed through a browser.

Link to comment
Share on other sites

Yeah all those images and includes may slow down your site. I save all my pages with php ext so that i always know what extension to refer to in my scripts. If you have a lot of code you could group them into php functions and save them in one file and just call the functions from there.

Edited by sansana
Link to comment
Share on other sites

Thanks, guys. I remembered I zipped up a previous build of my site and reverted back to a previous file, and got the drop down to work again. I'll try recreating this until I come across the mistake again. I'll have to do some more studying to get a better idea of how to work with php properly, too. :)

Edited by taaron12
Link to comment
Share on other sites

One way to look at the php include in the manner that your using it for is that you want to save retyping your menu on every page. The easiest way to make sure you only include the correct information is to lay the page out in regular no include style first then find the section that is going to be for the menu and repeated on every page. Cut that section out and paste it to another text file but do not add any other tags such as <html> <head> or anything only leave the part you cut. Name that something such as menu.php and the include would be as you typed (making sure to use the right file name for the include. <div id = "menu"><?php include ('shared/menu/menu.php');?></div>what this does is simply replaces the link " <?php include ('shared/menu/menu.php');?> " with everything that is in the file so since it will be apart of that page that is why there is no need to include the <html> and other tags again because they are already there. http://www.w3schools.com/php/php_includes.aspExample two on this page is a good example of what you are trying to do. Your menu is a little more complex but still has the same idea to it, which is just using the include to show your menu on every page without having to type it repeatedly or look at the menu and the rest of the code at the same time.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...