Jump to content


Photo

Source Code Displayed In Plain Text


  • Please log in to reply
5 replies to this topic

#1 izzy

izzy
  • Members
  • PipPipPip
  • Advanced Member
  • 31 posts

Posted 29 June 2006 - 10:42 AM

Hi,

I'm trying to display a bit of HTML code on my page so my users can copy this to their websites if they want to.
It is supposed to be a direct link to their own userpage on my site.

This is what i want to display on my page. In plain text

<a href="http://www.mypage.co...ex.php?id=<?php echo"$id";?>"<img src="http://www.mypage.co...t-logo.png"</a>

Every way i've tried it just keeps recognising parts as HTML or PHP.

Can someone tell me how to fix this problem?

#2 wildteen88

wildteen88
  • Staff Alumni
  • Advanced Member
  • 10,482 posts
  • LocationUK, Bournemouth

Posted 29 June 2006 - 10:45 AM

Use htmlentities, function ie:
$str = '<a href="http://www.mypage.com/index.php?id=<?php echo"$id";?>"<img src="http://www.mypage.com/bnt-logo.png"></a>';

echo htmlentities($str);

Also how is <?php echo"$id";?> going to work? How is the $id variable going to be set on the other persons site they post it on?

#3 izzy

izzy
  • Members
  • PipPipPip
  • Advanced Member
  • 31 posts

Posted 29 June 2006 - 10:53 AM

[!--quoteo(post=389195:date=Jun 29 2006, 12:45 PM:name=wildteen88)--][div class=\'quotetop\']QUOTE(wildteen88 @ Jun 29 2006, 12:45 PM) View Post[/div][div class=\'quotemain\'][!--quotec--]

Also how is <?php echo"$id";?> going to work? How is the $id variable going to be set on the other persons site they post it on?
[/quote]

Sorry... that part is actually not supposed to be in plain text, that is supposed to echo/display the user id in question.

Could you please help me with that too?


#4 hvle

hvle
  • Members
  • PipPipPip
  • Advanced Member
  • 667 posts
  • Locationmelbourne, Australia

Posted 29 June 2006 - 11:34 AM

do this, this is easiest and on top of my head:

$id = 235435;

$str = <<<BLOCK

<a href="http://www.mypage.com/index.php?id=$id"<img src="http://www.mypage.co...-logo.png"></a>

BLOCK;


echo htmlentities($str);
Life's too short for arguing.

#5 izzy

izzy
  • Members
  • PipPipPip
  • Advanced Member
  • 31 posts

Posted 29 June 2006 - 12:39 PM

Thanx !!!



#6 hsncool

hsncool
  • New Members
  • Pip
  • Newbie
  • 6 posts

Posted 29 June 2006 - 04:14 PM

OMGOSH!

U GUYS HAV TO DO EVRYTHING THE HARDWAY DONT U!

lol, all u gota do
is insert this code into ur script.....

echo('&lt;a href=&quot;http://www.mypage.com/index.php?id=' . $id . '&quot;&lt;img src=&quot;http://www.mypage.com/bnt-logo.png&quot;&lt;/a&gt;');


how i did this ?

put wat u want to b display in the "design" part of a blank dreamweaver doc, and then check what the code for it is!

easy!




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users