Welcome to WebmasterWorld Guest from

Forum Moderators: coopster & jatar k

Message Too Old, No Replies

Embedding an if statement



1:41 pm on Feb 1, 2009 (gmt 0)

5+ Year Member

Noob here, both to the forum and to coding. I hope this is a simple question!

What I have is a menu that I want a part of only shown to logged in members. I have tried if($loggedin == 1) echo with "'s and {'s in various places but I only get Parse error: syntax error, unexpected T_IF in /home/amiabl/public_html/cm/data.php on line 38.

Could someone tell me the proper way to form this operation?
Here is the line of code:

$config['footer'] = "<font color='#C0C0C0'><b>&copy; {$config['site_name']}</font> <a href='privacy.php'>Privacy</a> <a href='tos.php'>TOS</a> <a target='_blank' href='{$config["forum"]}'>Forum</a> <a href='banner.php'>Banner</a> <a href='proof_of_payments.php'>Payments</a> <a href='purchase35.php'>Purchase Referrals</a> <a href='upgrade.php'>Upgrade</a><br><center></center>";

I want to start right after TOS displaying only to logged in members. Any help will be very much appreciated.


10:35 pm on Feb 2, 2009 (gmt 0)

10+ Year Member

Hello surfshare,

and welcome to WebmasterWorld!

As I can see you're mixing single and double quotes inside your statement. That is hell do debug.

You'd better use sprintf(), using single quotes only outside and double quotes only inside your sprintf() format (or vice versa):

$config['footer'] = sprintf('<font color="#C0C0C0"><b>&copy; %s</font> <a href="privacy.php">Privacy</a> <a href="tos.php">TOS</a> <a target="_blank" href="%s">Forum</a> <a href="banner.php">Banner</a> <a href="proof_of_payments.php">Payments</a> <a href="purchase35.php">Purchase Referrals</a> <a href="upgrade.php">Upgrade</a><br><center></center>', $config['site_name'], $config["forum"]);

Hope that helps!


11:08 pm on Feb 2, 2009 (gmt 0)

5+ Year Member

Thanks for the welcome and the reply Morgenhund!

I will give this a try and let you know how it works.


Featured Threads

Hot Threads This Week

Hot Threads This Month