Jump to content

I'm getting a syntax error in my file.. please help!! :(


techiefreak05

Recommended Posts

Hi, I have a php file that holds all my phph "functions" and for some reason I get this error: "Parse error: syntax error, unexpected T_STRING, expecting ',' or ';' in /home/zyco/public_html/newlayout/func.php on line 51"  when I use this code:

[code]<?php
function DisplayLinks(){
echo "<div align=center>
<OBJECT classid=\"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000\"
codebase=\"http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=5,0,0,0\"
WIDTH=550 HEIGHT=24>
<PARAM NAME=movie VALUE=basetab2x_vl.swf?tarframe=_self&exbackground=FFFFFF&makenavfield0=-LINKS-&makenavurl0=&makenavfield1=Home&makenavurl1=main.php&makenavfield2=Contact Us&makenavurl2=contactus&makenavfield3=Register&makenavurl3=register&makenavfield4=Forums&makenavurl4=http://www.forums.zycogaming.xerodefect.com\">
<PARAM NAME=loop VALUE=false>
<PARAM NAME=menu VALUE=false>
<PARAM NAME=quality VALUE=high>
<PARAM NAME=scale VALUE=noborder>
<PARAM NAME=salign VALUE=LT>
<PARAM NAME=wmode VALUE=transparent>
<PARAM NAME=bgcolor VALUE=#333366>

<EMBED src=\"/files/basetab2x_vl.swf?tarframe=_self&exbackground=FFFFFF&makenavfield0=-LINKS-&makenavurl0=&makenavfield1=Home&makenavurl1=main.php&makenavfield2=Contact Us&makenavurl2=contactus&makenavfield3=Register&makenavurl3=register&makenavfield4=Forums&makenavurl4=http://www.forums.zycogaming.xerodefect.com\" loop=false menu=false quality=high scale=noborder salign=LT wmode=transparent bgcolor=#333366  WIDTH=550 HEIGHT=24 TYPE=\"application/x-shockwave-flash\" PLUGINSPAGE=\"http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash\"></EMBED>

</OBJECT>

<script language =\"javascript\">

theObjects = document.getElementsByTagName(\"object\");
for (var i = 0; i < theObjects.length; i++) {
theObjects[i].outerHTML = theObjects[i].outerHTML;}

</script>
</div>";
}

function show_errorPage(){
echo "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\"
\"http://www.w3.org/TR/html4/loose.dtd\">
<html>
<!-- DW6 -->
<head>
<meta http-equiv=\"Content-Type\" content=\"text/html; charset=iso-8859-1\">
<title>ZycoWorld</title>
<link rel=\"stylesheet\" href=\"/files/3col_rightNav.css\" type=\"text/css\">
</head>
<body link=\"#FF3333\" vlink=\"#FF3333\" alink=\"#000000\">
<div id=\"masthead\">
  <h1 id=\"siteName\">Zyco</h1>
  <div id=\"globalNav\">
<? DisplayLinks(); ?></div>
  <br>
<hr align=\"left\" width=55%>
<h2 id=\"pageName\">Home</h2>
<!-- end masthead -->
<div id=\"content\">
<hr>
  <div><span class="feature">
    <! - img src=\"\" alt=\"\" width="250" height="250">
    <h3>You Must Be Logged In</h3>
    <p>
    You canot view this page, you need to Login at the <A HREF=\"main.php\">HOME</A> Page, or <A HREF=register>REGISTER<A> to be able to view..
  </div>
  <div class=\"story\">
    <h3></h3>
    <p>
    </p>
    <p>
    </p>
  </div>
</div>
<!-- end content -->
<div id=\"navBar\">
  <div id=\"search\">
<form action=\"http://www.zycogaming.xerodefect.com/cgi-sys/entropysearch.cgi\" target=\"searchwindow\">
Zyco SiteSearch: <br><input name=\"query\" value=\"\" type=\"text\">
<input name=\"user\" value=\"zyco\" type=\"hidden\">
<input name=\"basehref\" value=\"http://zycogaming.xerodefect.com\" type=\"hidden\">
<input name=\"template\" value=\"default\" type=\"hidden\">
<input value=\"Search\" type=\"submit\">
</form>
  </div>
  <div id=\"sectionLinks\">
    <h3>Please Login</h3>
    <form action=\"\" method=\"post\">
      <table align=\"center\" border=\"0\" cellspacing=\"0\" cellpadding=\"3\">
<tr><td >Username:</td><td><input type=\"text\" name=\"user\" maxlength=\"30\"></td></tr>
<tr><td >Password:</td><td><input type=\"password\" name=\"pass\" maxlength=\"30\"></td></tr>
<tr><td colspan=\"2\" align=\"left\" ><input type=\"checkbox\" name=\"remember\">
<font size=\"2\">Remember</td></tr>
<tr><td colspan=\"2\" align=\"right\"><input type=\"submit\" name=\"sublogin\" value=\"Login\"></td></tr>
<tr><td  colspan=\"2\" align=\"right\"><a href=\"register\"><img
src=/images/reg_img.gif
name=pic1
onMouseOver=\"document.pic1.src='/images/reg_img2.GIF' \" onMouseOut=\"document.pic1.src='/images/reg_img.gif' \"
></a></td></tr>
</table>
    </form>
  </div>
  <div class=\"relatedLinks\">
    <h3>Affiliates</h3>
    <ul>
      <li><a href=\"http://www.flamelicker.com/newsite\">Flamelicker</a></li>
 
    </ul>
  </div>
  <div class=\"relatedLinks\">
    <h3>Other</h3>
    <ul>
      <li><A HREF=\"http://www.zycogaming.xerodefect.com/brenden\">Brenden's zPage</A></li>
  </li>
    </ul>
  </div>
</div>
<!--end navBar div -->
<div id=\"siteInfo\">
  <p><img src=\"\" width=\"44\" height=\"22\"> &copy;2006 ZycoWorld.com</p>
  <div align=center>
  <ul>
  <A HREF=http://www.zycogaming.xerodefect.com/home>Home</A> |
  <A HREF=http://www.zycogaming.xerodefect.com/contactUs>Contact Us</A>
  </ul>
  </div>
</div>
</body>
</html>";
}
?>[/code]

??? ??? ??? ??? ??? ??? ??? ???
Link to comment
Share on other sites

...
.....

Why are you echoing you're entire page?!

If you must echo the entire thing, at least use Heredoc, but you shouldn't have to.  Just close the PHP tags before your HTML and open them back up again afterwards, and when needed inside the file.
Link to comment
Share on other sites

Yeah I know.. I have pages like that, you mean like this...?? this is NOT the page from above, its a different one on my site

[code]<?php
if($logged_in){
?>
<html>
<!-- DW6 -->
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<title>ZycoWorld</title>
<link rel="stylesheet" href="files/3col_rightNav.css" type="text/css">
</head>
<body link="#FF3333" vlink="#FF3333" alink="#000000">
<div id="masthead">
  <h1 id="siteName"><IMG SRC=files/zyLogo1.jpg></h1>
  <div id="globalNav">
<? DisplayLinks(); ?>
</div>
  <span class="relatedLinks">Hello,
  <strong><?php echo "$_SESSION[username]"; ?></strong>
.</span> | <A HREF=http://www.zycogaming.xerodefect.com/logout>Logout</A> | <a href="http://www.zycogaming.xerodefect.com/<?php echo "$_SESSION[username]"; ?>.html">View Profile</a> | <a href="http://www.zycogaming.xerodefect.com/editProfile">Edit Profile</a> |<br>
<span class="feature">Your zPage URL: http://www.zycogaming.xerodefect.com/<?php echo "$_SESSION[username]"; ?>.html
</span>
<hr align="left" width=55%>
<h2 id="pageName">Home</h2>
<!-- end masthead -->
<div id="content">
<hr>
  <div><span class="feature">
    <! - img src="" alt="" width="250" height="250">
    <h3>Welcome</h3>
    <p>
    Welcome to the all new ZycoWorld! We are the next big thing in online entertainment, in partnership with <a href="http://www.flamelicker.com" title="Flamelicker">Flamelicker</a>, we stride to bring you the absolute best in Internet media and communicatiions.<p>
</p>
    </span>
    <p class="feature"><strong>Some features include:<br>
        <br>
      Create your Own Profile<br>
      Picture and Video Uploads<br>
      Games, and much more</strong>!
    </p>
  </div>
  <div class="story">
    <h3>Site Updates:</h3>
    <p>
    -- New Site Layout Added!</p>
  </div>
  <div class="story">
    <h3>&nbsp;</h3>
    <p>&nbsp;
    </p>
    <p>&nbsp;
    </p>
  </div>
</div>
<!-- end content -->
<div id="navBar">
  <div id="search">
<form action="http://www.zycogaming.xerodefect.com/cgi-sys/entropysearch.cgi" target="searchwindow">
Zyco SiteSearch: <br><input name="query" value="" type="text">
<input name="user" value="zyco" type="hidden">
<input name="basehref" value="http://zycogaming.xerodefect.com" type="hidden">
<input name="template" value="default" type="hidden">
<input value="Search" type="submit">
</form>
  </div>
  <div id="sectionLinks">
    <h3>Your Controls</h3>
    <ul>
      <li><a href="http://www.zycogaming.xerodefect.com/home">Home</a></li>
      <li><a href="http://www.zycogaming.xerodefect.com/vidUpload">Video Upload</a></li>
      <li><a href="http://www.zycogaming.xerodefect.com/imageUpload">Picture Upload</a></li>
      <li><a href="http://www.zycogaming.xerodefect.com/editProfile">Edit Profile</a></li>
      <li><a href="http://www.zycogaming.xerodefect.com/<?php $_SESSION[username].html ?> ">View Profile</a></li>
      <li><a href="http://www.zycogaming.xerodefect.com/gamesList">Games</a></li>
    </ul>
  </div>
  <div class="relatedLinks">
    <h3>Affiliates</h3>
    <ul>
      <li><a href="http://www.flamelicker.com/newsite">Flamelicker</a></li>
  <li><a href="http://www.xerodefect.com">XeroDefect Studios</a></li>
    </ul>
  </div>
  <div class="relatedLinks">
    <h3>Other</h3>
    <ul>
      <li><A HREF="http://www.zycogaming.xerodefect.com/brenden">Brenden's zPage</A></li>
  </li>
    </ul>
  </div>
</div>
<!--end navBar div -->
<div id="siteInfo">
  <p><img src="" width="44" height="22"> &copy;2006 ZycoWorld.com</p>
  <div align=center>
  <ul>
  <A HREF=http://www.zycogaming.xerodefect.com/home>Home</A> |
  <A HREF=http://www.zycogaming.xerodefect.com/contactUs>Contact Us</A>
  </ul>
  </div>
</div>
</body>
</html>
<?php
}else{
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<!-- DW6 -->
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<title>ZycoWorld</title>
<link rel="stylesheet" href="/files/3col_rightNav.css" type="text/css">
</head>
<body link="#FF3333" vlink="#FF3333" alink="#000000">
<div id="masthead">
  <h1 id="siteName"><IMG SRC=files/zyLogo1.jpg></h1>
  <div id="globalNav">
<? DisplayLinks(); ?></div>
  <br>
<hr align="left" width=55%>
<h2 id="pageName">Home</h2>
<!-- end masthead -->
<div id="content">
<hr>
  <div><span class="feature">
    <! - img src="" alt="" width="250" height="250">
    <h3>Welcome</h3>
    <p>
    Welcome to the all new ZycoWorld! We are the next big thing in online entertainment, in partnership with <a href="http://www.flamelicker.com" title="Flamelicker">Flamelicker</a>, we stride to being you the absolute best in Internet media and communicatiions.<p></p>
    </span>
    <p class="feature"><strong>Some features include:<br>
        <br>
      Create your Own Profile<br>
      Picture and Video Uploads<br>
      Games, and much more</strong>!
    </p>
  </div>
  <div class="story">
    <h3>Site Updates:</h3>
    <p>
    -- New Site Layout Added!</p>
  </div>
  <div class="story">
    <h3>&nbsp;</h3>
    <p>&nbsp;
    </p>
    <p>&nbsp;
    </p>
  </div>
</div>
<!-- end content -->
<div id="navBar">
  <div id="search">
<form action="http://www.zycogaming.xerodefect.com/cgi-sys/entropysearch.cgi" target="searchwindow">
Zyco SiteSearch: <br><input name="query" value="" type="text">
<input name="user" value="zyco" type="hidden">
<input name="basehref" value="http://zycogaming.xerodefect.com" type="hidden">
<input name="template" value="default" type="hidden">
<input value="Search" type="submit">
</form>
  </div>
  <div id="sectionLinks">
    <h3>Please Login</h3>
    <form action="" method="post">
      <table align="center" border="0" cellspacing="0" cellpadding="3">
<tr><td >Username:</td><td><input type="text" name="user" maxlength="30"></td></tr>
<tr><td >Password:</td><td><input type="password" name="pass" maxlength="30"></td></tr>
<tr><td colspan="2" align="left" ><input type="checkbox" name="remember">
<font size="2">Remember</td></tr>
<tr><td colspan="2" align="right"><input type="submit" name="sublogin" value="Login"></td></tr>
<tr><td  colspan="2" align="right"><a href="register"><img
src=/images/reg_img.gif
name=pic1
onMouseOver="document.pic1.src='/images/reg_img2.GIF' " onMouseOut="document.pic1.src='/images/reg_img.gif' "
></a></td></tr>
</table>
    </form>
  </div>
  <div class="relatedLinks">
    <h3>Affiliates</h3>
    <ul>
      <li><a href="http://www.flamelicker.com/newsite">Flamelicker</a></li>
 
    </ul>
  </div>
  <div class="relatedLinks">
    <h3>Other</h3>
    <ul>
      <li><A HREF="http://www.zycogaming.xerodefect.com/brenden">Brenden's zPage</A></li>
  </li>
    </ul>
  </div>
</div>
<!--end navBar div -->
<div id="siteInfo">
  <p><img src="" width="44" height="22"> &copy;2006 ZycoWorld.com</p>
  <div align=center>
  <ul>
  <A HREF=http://www.zycogaming.xerodefect.com/home>Home</A> |
  <A HREF=http://www.zycogaming.xerodefect.com/contactUs>Contact Us</A>
  </ul>
  </div>
</div>
</body>
</html>
<?php
}
?>

[/code]

that page works too, I guess I just do that.. haha
Link to comment
Share on other sites

[quote author=onlyican link=topic=103127.msg410453#msg410453 date=1154822532]
i echo everything
I hate breaking in and out of php
[/quote]

It is much slower to echo everything instead of switching to HTML. You should only echo lines that have dynamic content. Also, it will be slower to echo lines that are double-quoted compared to single-quoted, as the PHP parser has to check the line to see if anything needs interpolating first. Having said that I am guilty of echoing static lines when they are in the middle of a bunch of lines with dynamic content, just purely for neatness' sake.
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.