Jump to content

Source Code Displayed In Plain Text


izzy

Recommended Posts

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.com/index.php?id=<?php echo"$id";?>"<img src="http://www.mypage.com/bnt-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?
Link to comment
Share on other sites

Use htmlentities, function ie:
[code]$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);[/code]

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?
Link to comment
Share on other sites

[!--quoteo(post=389195:date=Jun 29 2006, 12:45 PM:name=wildteen88)--][div class=\'quotetop\']QUOTE(wildteen88 @ Jun 29 2006, 12:45 PM) [snapback]389195[/snapback][/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?
Link to comment
Share on other sites

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.com/bnt-logo.png"></a>

BLOCK;


echo htmlentities($str);
Link to comment
Share on other sites

OMGOSH!

U GUYS HAV TO DO EVRYTHING THE HARDWAY DONT U!

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

[code]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;');[/code]


[b]how i did this ?[/b]

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!
Link to comment
Share on other sites

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.