need help with parse stuff

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
pinehead18
Forum Contributor
Posts: 329
Joined: Thu Jul 31, 2003 9:20 pm

need help with parse stuff

Post by pinehead18 »

Ok, i'm trying to pull the table color from a config setting i'm making but this sytax i have made is wrong. Thank you for any help you can provide.

Code: Select all

echo "<td style=\"border-top: 2px solid #3D4A67; border-left: 2px solid #3D4A67; background-color: "; $config['bgcolor_main']; echo "\" height=\"7%\">hi";
Parse error: parse error, unexpected ';' in /home/pinehead/www/config.inc.php on line 29


That is my error, i'm sure this is not the best way to do this so if you can suggest a better way that would be great too.

Thank you
Anthony
User avatar
Joe
Forum Regular
Posts: 939
Joined: Sun Feb 29, 2004 1:26 pm
Location: UK - Glasgow

Post by Joe »

Try:

Code: Select all

echo "<td style=\"border-top: 2px solid #3D4A67; border-left: 2px solid #3D4A67; background-color: ". $config['bgcolor_main']. ";\" height=\"7%\">hi</td>";
pinehead18
Forum Contributor
Posts: 329
Joined: Thu Jul 31, 2003 9:20 pm

Post by pinehead18 »

I don't get the parse error anymore, but it will not display the conents in that var..

Any ideaS?
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

are you sure there's data in it that can print?

Code: Select all

var_dump($config['bgcolor_main']);
pinehead18
Forum Contributor
Posts: 329
Joined: Thu Jul 31, 2003 9:20 pm

Post by pinehead18 »

Var dump dumps the right information.. But when i have it in that code above it will not post the right information.
User avatar
Ambush Commander
DevNet Master
Posts: 3698
Joined: Mon Oct 25, 2004 9:29 pm
Location: New Jersey, US

Post by Ambush Commander »

Code: Select all

echo "<td
style=\"border-top: 2px solid #3D4A67; border-left: 2px solid #3D4A67; background-color:{$config['bgcolor_main']};\"
height=\"7%\">
hi
</td>";
var_dump($config['bgcolor_main']);
Give us the exact output.
pinehead18
Forum Contributor
Posts: 329
Joined: Thu Jul 31, 2003 9:20 pm

Post by pinehead18 »

Still does not work inside the <td> but does dump the correct information
User avatar
John Cartwright
Site Admin
Posts: 11470
Joined: Tue Dec 23, 2003 2:10 am
Location: Toronto
Contact:

Post by John Cartwright »

repost EXACKLY what you are doing.
Post Reply