Parse error: syntax error, unexpected '<' in C:\xampp\htdocs\eifel\title_bar.php

Hi,
I have a development server for PHP that runs XAMPP. The problem that I have is that it is saying I have a parse error. I am a complete newbie to PHP. The error I get when I run the pages exact directory off local host is:

“Parse error: syntax error, unexpected ‘<’ in C:\xampp\htdocs\eifel\title_bar.php on line 4”

Honestly, I don’t see any missing curly braces, nor semi-colons. So, what is the problem with my code? But there is something that Notepad++ is giving me which I don’t see how to fix. There are wavy red lines under the file extension ‘.php’ so I’m not sure why. Please help me, the code for the class is below. Any help, in any sort of way is appreciated!

The code for the ‘title_bar.php’ class:
[embed=425,349]


<?php
if(loggedin()){
Home
Messages
Log Out
}else{
echo “Not Logged In”;
}
}
Home
Login
Register

[/embed]

Thanks,
[bArman[/b]

First things first, I question if (loggedin()) { portion of the script and I took the following liberties in guessing what you’re trying to accomplish:

[php]<?php
/* Get Rid of Comments to see what navigation /
/
looks like when logged-in. */
//$user = “John Wayne”
?>

Understanding PHP 101 body { font-size: 100%; } .nav { display: block; width: 600px; height: 40px; background-color: orange;} .nav ul { list-style: none;} .nav ul li a { display: block; float: left; width: 140px; height: auto; border-right: 2px solid #fff; line-height: 40px; color: #fff; font-size: 1.2rem; text-decoration: none; text-align: center; } .nav ul li a:hover { color: #2e2e2e; }
  • Home
  • <?php //if(loggedin()){ // You might be using a framework, // but I don't know for I don't do frameworks if (isset($user)) { // So I did a little guessing on my part: echo '
  • Messages
  • '; echo '
  • Log Out
  • '; }else{ echo '
  • Login
  • '; echo '
  • Register
  • '; } ?>
[/php]

Anytime you have html in php you have to echo it out — OR— keep closing the php code off with <?php ?> (Which I personally find messy). Anyways like I said I guessing what you want. One last suggestion, I would get the HTML/CSS done a little more pat (learn it better is what I mean), it will help you in the long run.

I hope this helps out a little bit? :-\ ;D

and to let you see that I practice in what I preach. :smiley:
[php]


  • Home

  • About

  • Forums

  • Tutorial

  • Contact

  • Gallery

  • The List

  • Trivia

  • <?php
    if ($pageTitle == “About | John R. Pepp” || $pageTitle == “HTML5, CSS3, jQuery and PHP Forums” || preg_match("/ Forum/i", $pageTitle)) {
    if ($user) {
    echo ‘
  • Logout
  • ’;
    } else {
    echo ‘
  • Login
  • ’;
    }
    }
    ?>
    <?php echo (!($user) && ($pageTitle == "HTML5, CSS3, jQuery and PHP Forums" || preg_match("/ Forum/i", $pageTitle))) ? '
  • Register
  • ' : NULL; ?>

[/php]

Php is not html,

[php] <?php
if(loggedin()){
?>
Home
Messages
Log Out

<?php }else{ echo "Not Logged In"; }[/php] So this is incorrect. Try, [php] <?php if(loggedin()){ Home Messages Log Out }else{ echo "Not Logged In"; }[/php]
Sponsor our Newsletter | Privacy Policy | Terms of Service