Jump to content


Photo

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


  • Please log in to reply
9 replies to this topic

#1 techiefreak05

techiefreak05
  • Members
  • PipPipPip
  • Advanced Member
  • 494 posts
  • LocationER, MN

Posted 05 August 2006 - 11:40 PM

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:

<?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>";
}
?>

??? ??? ??? ??? ??? ??? ??? ???
Link shortener with advanced, detailed statistics:

http://tyny.us/

#2 onlyican

onlyican
  • Members
  • PipPipPip
  • Advanced Member
  • 921 posts
  • LocationHants - UK

Posted 05 August 2006 - 11:42 PM

Line 51 has
<div><span class="feature">
either use 'feature'>
or \"feature\">
Tell me the problem, I will try tell you the solution

#3 techiefreak05

techiefreak05
  • Members
  • PipPipPip
  • Advanced Member
  • 494 posts
  • LocationER, MN

Posted 05 August 2006 - 11:45 PM

!! :) thanks! I kinda flew through adding all those slahes.. god it took a long time! haha sorry for my dumb mistake!
Link shortener with advanced, detailed statistics:

http://tyny.us/

#4 nethnet

nethnet
  • Members
  • PipPipPip
  • Advanced Member
  • 284 posts
  • LocationPhiladelphia, PA, USA

Posted 05 August 2006 - 11:47 PM

...
.....

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.
"Creativity is allowing yourself to make mistakes. Art is knowing which ones to keep."  --Scott Adams

Current project: nethnet.com

#5 techiefreak05

techiefreak05
  • Members
  • PipPipPip
  • Advanced Member
  • 494 posts
  • LocationER, MN

Posted 05 August 2006 - 11:51 PM

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

<?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
}
?>


that page works too, I guess I just do that.. haha
Link shortener with advanced, detailed statistics:

http://tyny.us/

#6 nethnet

nethnet
  • Members
  • PipPipPip
  • Advanced Member
  • 284 posts
  • LocationPhiladelphia, PA, USA

Posted 05 August 2006 - 11:57 PM

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.
"Creativity is allowing yourself to make mistakes. Art is knowing which ones to keep."  --Scott Adams

Current project: nethnet.com

#7 onlyican

onlyican
  • Members
  • PipPipPip
  • Advanced Member
  • 921 posts
  • LocationHants - UK

Posted 06 August 2006 - 12:02 AM

i echo everything
I hate breaking in and out of php
Tell me the problem, I will try tell you the solution

#8 techiefreak05

techiefreak05
  • Members
  • PipPipPip
  • Advanced Member
  • 494 posts
  • LocationER, MN

Posted 06 August 2006 - 02:59 AM

its SOO much easier to NOT echo, lol but sometimes i do, i really dont know why tho :P
Link shortener with advanced, detailed statistics:

http://tyny.us/

#9 onlyican

onlyican
  • Members
  • PipPipPip
  • Advanced Member
  • 921 posts
  • LocationHants - UK

Posted 06 August 2006 - 09:55 AM

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
Tell me the problem, I will try tell you the solution

#10 king arthur

king arthur
  • Members
  • PipPipPip
  • Advanced Member
  • 335 posts
  • LocationUK HQ

Posted 06 August 2006 - 10:44 AM

i echo everything
I hate breaking in and out of php


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.
Sir Isaac Newton said "If I have seen farther, it is by standing on the shoulders of giants". But it is not recorded as to whether he said it before or after he was hit on the head by a falling apple.




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users