Jump to content

Recommended Posts

Wrap the html in single quotes:
[code=php:0]echo '<img src="http://www.mysite.com/path/to/ad/image">';[/code]
Note if you do this:
[code=php:0]echo "<img src="http://www.mysite.com/path/to/ad/image">";[/code]
You will have to escape the double quotes in the string too. So it will be like this:
[code=php:0]echo "<img src=\"http://www.mysite.com/path/to/ad/image\">";[/code]
If you dont you will get errors. As PHP will think you are ending the print/echo statement and then throw's an unexpecting string in blah bla blah.
How would i do it with this code then  ???  :-\

[CODE]
<!-- Begin: AdBrite -->
<br /><div align="center">
<script type="text/javascript">
  var AdBrite_Title_Color = '000000';
  var AdBrite_Text_Color = '000000';
  var AdBrite_Background_Color = 'FFFFFF';
  var AdBrite_Border_Color = 'FFFFFF';
</script>
<span style="white-space:nowrap;"><script src="http://ads.adbrite.com/mb/text_group.php?sid=197042&zs=3436385f3630" type="text/javascript"></script><!--
--><br /></span>
<!-- End: AdBrite -->
[/CODE]

Thanks Alot :)
Best of using herdoc syntax:
[code=php:0]echo <<<HTMLBLOCK
<!-- Begin: AdBrite -->
<br /><div align="center">
<script type="text/javascript">
  var AdBrite_Title_Color = '000000';
  var AdBrite_Text_Color = '000000';
  var AdBrite_Background_Color = 'FFFFFF';
  var AdBrite_Border_Color = 'FFFFFF';
</script>
<span style="white-space:nowrap;"><script src="http://ads.adbrite.com/mb/text_group.php?sid=197042&zs=3436385f3630" type="text/javascript"></script><!--
--><br /></span>
<!-- End: AdBrite -->
HTMLBLOCK;
// DO NOT PLACE ANYTHINK ON/CHANGE THE LINE ABOVE![/code]

It is best to use HEREDOC syntax when echo'ing large amounts of HTML. Note if you use variables within heredoc you may need to wrap it in curly braces (example: [code=php:0]{$varname}[/code])
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.