Jump to content

Archived

This topic is now archived and is closed to further replies.

techiefreak05

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

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]

??? ??? ??? ??? ??? ??? ??? ???

Share this post


Link to post
Share on other sites
Line 51 has
<div><span class="feature">
either use 'feature'>
or \"feature\">

Share this post


Link to post
Share on other sites
!! :) thanks! I kinda flew through adding all those slahes.. god it took a long time! haha sorry for my dumb mistake!

Share this post


Link to post
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.

Share this post


Link to post
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

Share this post


Link to post
Share on other sites
Yup.  It makes it much cleaner (not to mention easier to maintain, since you don't have all those slashes :))

But, whatever works for you.

Share this post


Link to post
Share on other sites
I was building a plain HTM page before, automaticly at the end of every line I would add
\n"
and start a new line with
."
Now, this dont work in HTM

Share this post


Link to post
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.

Share this post


Link to post
Share on other sites

×

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.