Author Topic: PHP syntaxembedding code into script  (Read 337 times)

0 Members and 1 Guest are viewing this topic.

Offline lookeeTopic starter

  • Irregular
  • Posts: 28
    • View Profile
PHP syntaxembedding code into script
« on: November 17, 2008, 01:58:18 AM »
I'm attempting to embed the following code into a .php file, but every time I do, I get a syntax error.

<div id="leaderboard_bridge"></div><script src="http://xs.mochiads.com/static/pub/swf/leaderboard.js" type="text/javascript"></script><script type="text/javascript">Mochi.addLeaderboardIntegration({partnerID: "x34551194587393"});</script>

The error I get is

Parse error: syntax error, unexpected '<' in /home/jumpodin/public_html/components/com_puarcade/puarcade.php on line 170

Basically, I don't know how to integrate this bit of code into my pre-existing .php script.  I can't remove the <.  I tried putting a ; at the end, but that doesn't work either.

Any help would be greatly apprecaited.

Offline Mr_J

  • Enthusiast
  • Posts: 186
    • View Profile
Re: PHP syntaxembedding code into script
« Reply #1 on: November 17, 2008, 02:05:49 AM »
Just give a link there to see the page please

Offline ratcateme

  • Devotee
  • Posts: 1,207
  • Gender: Male
    • View Profile
Re: PHP syntaxembedding code into script
« Reply #2 on: November 17, 2008, 02:06:55 AM »
you need to echo it like
echo '<div id="leaderboard_bridge"></div><script src="http://xs.mochiads.com/static/pub/swf/leaderboard.js" type="text/javascript"></script><script type="text/javascript">Mochi.addLeaderboardIntegration({partnerID: "x34551194587393"});</script>';

Scott.

Offline lookeeTopic starter

  • Irregular
  • Posts: 28
    • View Profile
Re: PHP syntaxembedding code into script
« Reply #3 on: November 17, 2008, 02:17:04 AM »
I can't link it or href it because it has to be embedded in the actual file.

The echo didn't show up inbetween the code tags....

Offline ratcateme

  • Devotee
  • Posts: 1,207
  • Gender: Male
    • View Profile
Re: PHP syntaxembedding code into script
« Reply #4 on: November 17, 2008, 02:19:29 AM »
replace it with
echo '<div id="leaderboard_bridge"></div><script src="http://xs.mochiads.com/static/pub/swf/leaderboard.js" type="text/javascript"></script><script type="text/javascript">Mochi.addLeaderboardIntegration({partnerID: "x34551194587393"});</script>';

Scott.

Offline lookeeTopic starter

  • Irregular
  • Posts: 28
    • View Profile
Re: PHP syntaxembedding code into script
« Reply #5 on: November 17, 2008, 02:21:15 AM »
And when I try to echo it...

Code: [Select]
echo "<div id="leaderboard_bridge"></div><script src="http://xs.mochiads.com/static/pub/swf/leaderboard.js" type="text/javascript"></script><script type="text/javascript">Mochi.addLeaderboardIntegration({partnerID: "x4455839574839567674"});</script>";

?>

The closing php tag doesn't turn red again... something is missing, and I can't figure out what... something in the embed code seems to be throwing off the syntax

Offline lookeeTopic starter

  • Irregular
  • Posts: 28
    • View Profile
Re: PHP syntaxembedding code into script
« Reply #6 on: November 17, 2008, 02:22:23 AM »
Thanks....

The crappy tutorial I read gave two quote marks...

<?php
echo "Hello World";