Unholy Prayer Posted November 15, 2006 Share Posted November 15, 2006 Ok, I'm making a CMS for my hosting company's customers to use as a default portal for their site. I'm trying to make the code that switches the link if the user is not logged in or logged in. For example, if the user is logged in, it will say "Logged in as: <user_name>". If they are not logged in, a link to the "register.php" page will appear. The error I am getting is this:Parse error: syntax error, unexpected T_ENCAPSED_AND_WHITESPACE, expecting T_STRING or T_VARIABLE or T_NUM_STRING in /home/mtechdev/public_html/portal/styles/default/menuright.tpl on line 5Line five of menuright.tpl is the following:[code]</tr><tr>[/code]This is the coding for the whole page:[code]<td align="right"><table align="right" width="160" cellspacing="0" cellpadding="0" border="0"><tr><td height="17" class="menuhead">Members Area</td></tr><tr><td height="17" class="navlinkrow"><?php if (!empty($online['id'])){ echo "Logged In As: '.stripslashes($online['username']).'"}; else { echo "<a href='login.php'>Login</a>"; } ?></td></tr><tr><td height="17" class="navlinkrow"><a href="register.php">Register</td></tr><tr><td height="17" class="navlinkrow"><a href="#">Password Retrieval</a></td></tr><tr><td height="17" class="navlinkrow"><a href="register.php?act=why">Why Register?</a></td></tr><tr><td height="17" class="navlinkrow"><a href="register.php?act=faqs">Registration FAQ's</a></td></tr><tr><td height="17" class="menuhead">Weekly Poll</td></tr><tr><td height="202" class="navlinkrow" align="left">Do you like this template?<br><input type="radio" name="vote">I love it!<br><input type="radio" name="vote">It's alright.<br><input type="radio" name="vote">I hate it.<br><br><input type="submit" value="Vote Now!"><br><br><br><br><br><br><br></td></tr></table></td>[/code]Can anyone help me?Anyone know why it would do this? Quote Link to comment Share on other sites More sharing options...
Branden Wagner Posted November 15, 2006 Share Posted November 15, 2006 take a look at....[code]<?php if (!empty($online['id'])){ echo "Logged In As: '.stripslashes($online['username']).'"}; else { echo "<a href='login.php'>Login</a>"; } ?>[/code]couple of things.. just replace it with this[code]<?php if(!empty($online['id'])){ echo "Logged In As: ".stripslashes($online['username']);} else { echo '<a href="login.php">Login</a>'; } ?>[/code]first problem is with your quote you start off with "Logged in as: ' <<---why a single quote?? just remove the single quotes, and the double at the end. second problem, you have a semicolon at the outside bracket of the if statement "};" Quote Link to comment Share on other sites More sharing options...
Unholy Prayer Posted November 15, 2006 Author Share Posted November 15, 2006 Erg, it was working for a little bit but now it says this: [quote]Parse error: syntax error, unexpected '<' in /home/mtechdev/public_html/portal/styles/default/menuright.tpl on line 7[/quote] Quote Link to comment Share on other sites More sharing options...
Branden Wagner Posted November 16, 2006 Share Posted November 16, 2006 whats the code on line 5-8? 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.