homepage Welcome to WebmasterWorld Guest from
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Become a Pro Member

Home / Forums Index / Code, Content, and Presentation / PHP Server Side Scripting
Forum Library, Charter, Moderators: coopster & jatar k

PHP Server Side Scripting Forum

Embedding an if statement

5+ Year Member

Msg#: 3839670 posted 1:41 pm on Feb 1, 2009 (gmt 0)

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+ Year Member

Msg#: 3839670 posted 10:35 pm on Feb 2, 2009 (gmt 0)

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!


5+ Year Member

Msg#: 3839670 posted 11:08 pm on Feb 2, 2009 (gmt 0)

Thanks for the welcome and the reply Morgenhund!

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

Global Options:
 top home search open messages active posts  

Home / Forums Index / Code, Content, and Presentation / PHP Server Side Scripting
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved