Seker Posted May 13, 2012 Share Posted May 13, 2012 I've put my mainmenu into a table. The problem is, it will not inherit the background-image from the right class. It's still just using the default table css. Can anyone see any problems? mainmenu.php: <?php /** * MCCodes Version 1.1.1 * Copyright (C) 2005-2012 Dabomstew * All rights reserved. * * Redistribution of this code in any form is prohibited, except in * the specific cases set out in the MCCodes Customer License. * * This code license may be used to run one (1) game. * A game is defined as the set of users and other game database data, * so you are permitted to create alternative clients for your game. * * If you did not obtain this code from MCCodes.com, you are in all likelihood * using it illegally. Please contact MCCodes to discuss licensing options * in this case. * * File: mainmenu.php * Signature: 03b30e7286ced73ca9a388223ffe4caf * Date: Tue, 13 Mar 12 10:41:49 +0000 */ if (strpos($_SERVER['PHP_SELF'], "mainmenu.php") !== false) { exit; } global $c, $ir; $hc = mysql_query("SELECT * FROM users WHERE hospital > 0"); $hospitalcount = mysql_num_rows($hc); $jc = mysql_query("SELECT * FROM users WHERE jail > 0"); $jailcount = mysql_num_rows($jc); print " <table class=treemenu width=100%><td align=center> <a href='index.php'>Home</a><br /> <a href='inventory.php'>Backpack</a><br /> <a href='explore.php'>Explore</a><br /> <a href='events.php'>"; $d = mysql_query( "SELECT COUNT(*) as cnt FROM events WHERE evUSER={$ir['userid']} AND evREAD=0", $c) or die(mysql_error()); $r = mysql_fetch_array($d); if ($r['cnt'] > 0) { print "<b>Events ({$r['cnt']})</b>"; } else { print "Events (0)"; } print "</a><br /> <a href='mailbox.php'>"; $d2 = mysql_query( "SELECT COUNT(*) as cnt FROM mail WHERE mail_to={$ir['userid']} AND mail_read=0", $c) or die(mysql_error()); $r = mysql_fetch_array($d2); if ($r['cnt'] > 0) { print "<b>Mail ({$r['cnt']})</b>"; } else { print "Mail (0)"; } print "</a><br /> <a href='gym.php'>Training</a><br /> <a href='criminal.php'>Crimes</a><br /> <a href='hospital.php'>Sick Bay ({$hospitalcount})</a><br /> <a href='revenge.php'>Revenge Center</a><br /> <a href='jail.php'>Cage ({$jailcount})</a><br />"; if ($ir['gang']) { print "\n<a href='yourgang.php'>Your District</a><br />"; } print " <a href='bank.php'>Gold Storage</a><br /> <a href='job.php'>Your Job</a><br /> <a href='attladder.php'>Attack Ladder</a><br /> <a href='crystaltemple.php'>Spend Tokens</a><br /> <a href='education.php'>Learning Center</a><br /> <a href='monopaper.php'>Newspaper</a> <a href='forums.php'>Forums</a><br />"; if ($ir['donatordays']) { print "</a> <a href='donatordailycrystals.php'><b>Donator Daily Crystals</b></a><br />"; } else { print "<a href='dailycrystals.php'><b>Daily Crystals</b></a><br />"; } print " <a href='search.php'>Search</a><br /> <a href='advsearch.php'>Advanced Search</a> <br /> <br /> <br /> <br /> <br />"; if ($ir['user_level'] > 1) { print "<hr /> <b>Staff Only</b><br />\n"; if ($ir['user_level'] < 6 and $ir['user_level'] != 4) { print "<a href='new_staff.php'>Staff Panel</a><br />\n"; } } if ($ir['user_level'] > 1) { print "<hr /> <b>Staff Online:</b>"; $q = mysql_query( "SELECT * FROM users WHERE laston > " . (time() - 900) . " AND user_level>1 ORDER BY userid ASC", $c); while ($r = mysql_fetch_array($q)) { $la = time() - $r['laston']; $unit = "secs"; if ($la >= 60) { $la = (int) ($la / 60); $unit = "mins"; } if ($la >= 60) { $la = (int) ($la / 60); $unit = "hours"; if ($la >= 24) { $la = (int) ($la / 24); $unit = "days"; } } print "<a href='viewuser.php?u={$r['userid']}'>{$r['username']}</a> ($la $unit)<br />"; } } if ($ir['donatordays']) { print "<hr /> <b>Donators Only</b><br /> <a href='ddreward.php'>Daily Donator Reward</a><br /> <a href='friendslist.php'>Friends List</a><br /> <a href='blacklist.php'>Black List</a>"; } print "<hr /> <a href='preferences.php'>Preferences</a><br /> <a href='preport.php'>Player Report</a><br /> <a href='helptutorial.php'>Help Tutorial</a><br /> <a href='gamerules.php'>Game Rules</a><br /> <a href='viewuser.php?u={$ir['userid']}'>My Profile</a><br /> <a href='logout.php'>Logout</a><hr /><br /> Time is now<br /> "; echo date('F j, Y') . "<br />" . date('g:i:s a') . "</td></table>"; The CSS for a default table and the treemenu class: [CSS]table { font-family: helvetica, arial, geneva, sans-serif; font-size: 9pt; background-repeat: repeat; border-color: #FFFFFF; color: white; background-image: url(http://*****.net/images/expbg.png) } table.treemenu { background-image: url(http://*****.net/images/tree331.png) background-repeat: no-repeat; }[/CSS] Quote Link to comment Share on other sites More sharing options...
Spudinski Posted May 13, 2012 Share Posted May 13, 2012 Firstly, wrap quotes around URLs when using them within a CSS property, it helps a lot when debugging later. Secondly, although your CSS selector looks valid I suggest you add an !important flag. You can read more about CSS precedence here: http://stackoverflow.com/questions/667223/css-precedence. As for the !important flag, how a look at the following to see how the !important is used in CSS: http://coding.smashingmagazine.com/2010/11/02/the-important-css-declaration-how-and-when-to-use-it/. Quote Link to comment Share on other sites More sharing options...
HauntedDawg Posted May 13, 2012 Share Posted May 13, 2012 Are you using Firebug to debug also? Quote Link to comment Share on other sites More sharing options...
Seker Posted May 13, 2012 Author Share Posted May 13, 2012 I actually got it working after like three hours of tinkering. I just tricked it a little bit. Included the top half of the menu with the header table as a <td> and added a class. Made the bottom half a second <td> as it seems you cannot stop image repeat in a <td>. At least, I couldn't figure it out. Any time I used no-repeat, the image just disappeared. I definitely will still read into !important, though. Thanks for the tip. @HauntedDawg: I've been trying to use Firebug, but I've yet to figure it out. It looks to me like it just says "Error" without telling me what the actual error is. Maybe it's because I'm using Chrome and it's considered "Firebug Lite" or maybe I'm just missing it completely. Will play around with it more, definitely. Quote Link to comment Share on other sites More sharing options...
Spudinski Posted May 13, 2012 Share Posted May 13, 2012 I actually got it working after like three hours of tinkering. I just tricked it a little bit. Included the top half of the menu with the header table as a <td> and added a class. Made the bottom half a second <td> as it seems you cannot stop image repeat in a <td>. At least, I couldn't figure it out. Any time I used no-repeat, the image just disappeared. I definitely will still read into !important, though. Thanks for the tip. @HauntedDawg: I've been trying to use Firebug, but I've yet to figure it out. It looks to me like it just says "Error" without telling me what the actual error is. Maybe it's because I'm using Chrome and it's considered "Firebug Lite" or maybe I'm just missing it completely. Will play around with it more, definitely. Chrome is more than up to par with Firebug. Chrome actually has the advantage of being able to directly communicate with the Javascript V8 engine. There's a lot of tutorials out there to guide on usage of debugging tools. Quote Link to comment 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.