seany123 Posted January 13, 2009 Share Posted January 13, 2009 This is a PHP/CSS question... im not very good with CSS but what im wanting to do is basically make it so the font is changed to a striked out text. can someone lend me a hand here? if ($investment == 0 || $investment == 1){ echo "<td bgcolor="#333333" class="centre"><a href="investment1.php">Invest</a></td>"; } else { echo "<td bgcolor="#333333" class="centre">Invest</td>"; //(im wanting the word "invest to be red and have a strike through it) } i know my php is also very sloppy and this code above would most likely give a error... so help on that would be good also. Quote Link to comment Share on other sites More sharing options...
xtopolis Posted January 13, 2009 Share Posted January 13, 2009 First, add to your CSS file / area this declaration: td.investTD { background-color: #333333; } td.noInvest { color: red; text-decoration: line-through; } Then you can change it to this: if ($investment == 0 || $investment == 1){ echo '<td class="centre investTD"><a href="investment1.php">Invest</a></td>'; } else { echo '<td class="centre investTD noInvest">Invest</td>'; } I changed the quotes, you had " on the outsides and also tried to " the properties on the insides causing it to prematurely end. Also, since you repeated the bgcolor in both, I abstracted that out into a class.. but if centre is the same, you could just add the background-color: #333333 to it instead and remove "investTD" from the class=" " areas. That should work, if it doesn't, post back. Quote Link to comment Share on other sites More sharing options...
seany123 Posted January 14, 2009 Author Share Posted January 14, 2009 I couldnt get it to work with the tables... this is the entire page and maybe you can change the 2nd table to make "invest" lose the link and become crossed out. <style type="text/css"> <!-- body,td,th { color: #FFFFFF; font-family: Arial; font-size: 16px; } body { background-color: #000000; font-size: 14px; } .font { font-size: 16px; } body p { font-size: 16px; } body p { font-size: 12px; } .Font { font-size: 14px; } .Font { font-size: 16px; } body p { font-size: 16px; } .font { font-size: 16px; } .font { font-size: 16px; } .font { font-size: 14px; } .Font1 { font-size: 14px; } .Font1 { font-size: 16px; } .centre { text-align: center; } .centretext { text-align: center; } .centre { text-align: left; } .centre { text-align: center; } .centre { text-align: center; } .highriskcolor { color: #F00; text-align: center; } .highriskcolor2 { color: #F60; text-align: center; } .mediumriskcolor { color: #FF0; text-align: center; } .lowriskcolor { color: #00F; text-align: center; } .ultralowriskcolor { color: #FFC; text-align: center; } .lowriskcolor { color: #FFC; text-align: center; } .ultralowriskcolor { color: #00F; text-align: center; } .centre { text-align: center; } .highriskcolor { color: #F00; } .highriskcolor2 { color: #F60; } .mediumriskcolor { color: #FF0; } .lowriskcolor { color: #FF9; } .ultralowriskcolor { color: #00F; } --> </style> <body link="#FF0000"><table width="650" border="1" cellpadding="0" cellspacing="0" bordercolor="#FF0000" bgcolor="#000000"> <tr> <td align="center" bordercolor="#FF0000" class="style49"><em><strong>Investment centre</strong></em></td> </tr> </table> <table width="650" border="0"> <tr> <th width="633" scope="col"> </th> </tr> <tr> <td>Welcome to the Investment Centre, here we give you the opportunity to invest in a series of different companies.</td> </tr> <tr> <td height="20"> </td> </tr> <tr> <td height="20"> <? if($player->rm == 0){ echo "You need to be a Respected member to invest in companies!!"; } if ($player->rm == 1) { echo "The list below is of the companies you can currently invest in."; }?> </td> </tr> </table> <p> <!-- MENU-LOCATION=NONE --> <!-- MENU-LOCATION=NONE --> <!-- MENU-LOCATION=NONE --></p> <table width="509" border="0" align="center"> <tr> <th width="179" bgcolor="#333333" scope="col"><span class="centretext">Company name</span></th> <th width="160" bgcolor="#333333" scope="col"><span class="centretext">Investment cost</span></th> <th width="76" bgcolor="#333333" scope="col">Risk</th> <th width="76" bgcolor="#333333" scope="col"><span class="centretext">Action</span></th> </tr> <tr> <td bgcolor="#333333" class="centre"> </td> <td bgcolor="#333333" class="centre"><span class="centretext">$10,000,000</span></td> <td bgcolor="#333333" class="ultralowriskcolor">Ultra Low</td> <td bgcolor="#333333" class="centre"><a href="investment1.php">Invest</a></td> </tr> <tr> <td height="20" bgcolor="#333333" class="centre"> </td> <td bgcolor="#333333" class="centre"><span class="centretext">$20,000,000</span></td> <td bgcolor="#333333" class="ultralowriskcolor">Ultra Low</td> <td bgcolor="#333333" class="centre"><a href="investment2.php">Invest</a></td> </tr> <tr> <td height="20" bgcolor="#333333" class="centre"> </td> <td bgcolor="#333333" class="centre"><span class="centretext">$30,000,000</span></td> <td bgcolor="#333333" class="lowriskcolor">Low</td> <td bgcolor="#333333" class="centre"><a href="investment3.php">Invest</a></td> </tr> <tr> <td height="20" bgcolor="#333333" class="centre"> </td> <td bgcolor="#333333" class="centre"><span class="centretext">$40,000,000</span></td> <td bgcolor="#333333" class="lowriskcolor">Low</td> <td bgcolor="#333333" class="centre"><a href="investment4.php">Invest</a></td> </tr> <tr> <td height="20" bgcolor="#333333" class="centre"> </td> <td bgcolor="#333333" class="centre"><span class="centretext">$50,000,000</span></td> <td bgcolor="#333333" class="mediumriskcolor">Medium</td> <td bgcolor="#333333" class="centre"><a href="investment5.php">Invest</a></td> </tr> <tr> <td height="20" bgcolor="#333333" class="centre"> </td> <td bgcolor="#333333" class="centre"><span class="centretext">$60,000,000</span></td> <td bgcolor="#333333" class="mediumriskcolor">Medium</td> <td bgcolor="#333333" class="centre"><a href="investment6.php">Invest</a></td> </tr> <tr> <td height="20" bgcolor="#333333" class="centre"> </td> <td bgcolor="#333333" class="centre"><span class="centretext">$70,000,000</span></td> <td bgcolor="#333333" class="highriskcolor2">High</td> <td bgcolor="#333333" class="centre"><a href="investment7.php">Invest</a></td> </tr> <tr> <td height="20" bgcolor="#333333" class="centre"> </td> <td bgcolor="#333333" class="centre"><span class="centretext">$80,000,000</span></td> <td bgcolor="#333333" class="highriskcolor2">High</td> <td bgcolor="#333333" class="centre"><a href="investment8.php">Invest</a></td> </tr> <tr> <td height="20" bgcolor="#333333" class="centre"> </td> <td bgcolor="#333333" class="centre"><span class="centretext">$90,000,000</span></td> <td bgcolor="#333333" class="highriskcolor">Extreme</td> <td bgcolor="#333333" class="centre"><a href="investment9.php">Invest</a></td> </tr> <tr> <td height="20" bgcolor="#333333" class="centre"> </td> <td bgcolor="#333333" class="centre"><span class="centretext">$100,000,000</span></td> <td bgcolor="#333333" class="highriskcolor">Extreme</td> <td bgcolor="#333333" class="centre"><a href="investment10.php">Invest</a></td> </tr> </table> </p> <p> </p> <p> </p> <p> <!-- MENU-LOCATION=NONE --> <?php include("templates/private_footer.php"); ?> </p> even though i wrote it... you can still most liekly make more sense outa it that me. Note - on this file i havnt added any of the code you provided simply because i dont want to confuse things. Quote Link to comment Share on other sites More sharing options...
xtopolis Posted January 14, 2009 Share Posted January 14, 2009 If this is hand coded - meaning you wrote all those table rows, I'm not going to change all of them. Why don't you fix it with the <? if($player->rm == 0){ echo "You need to be a Respected member to invest in companies!!"; } if ($player->rm == 1) { echo "The list below is of the companies you can currently invest in."; }?>] section. You should make that be if($player->rm == 1){ //show invest table }else{ Show table, but no invest columns } 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.