Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

daft question re echo

Status
Not open for further replies.

peasepud

Programmer
Jul 20, 2007
35
0
0
Im having a brain freeze and cant get it into gear so have what is a stupid question!

Im trying to put a description on a links page of the code to use when linking to a clients site and have it coming from php (as I want the alt code to be randomly selected from a dozen options) but for the life of me I cant think how to display it without actually displaying the banner!

ie I want to output

<a href=" src=" alt="the alt description"></a>

but I actually want it to display the above text on the page rather than have the page parse the html and display a banner.

Can a balding bloke have a blonde moment?
 
There are several ways to do this, the most straight forward would be: either in a textarea so the html does not get parsed, or use htmlentities on the string, so all the html tags get replaced by their display characters , and as such don't get rendered by the browser.

i.e.
Code:
<textarea><a href="[URL unfurl="true"]www.mydomain.com><img[/URL] src="[URL unfurl="true"]www.mydomain.com/images/bannerimage"[/URL] alt="the alt description"></a></textarea>
or
Code:
$mystring='<a href="[URL unfurl="true"]www.mydomain.com><img[/URL] src="[URL unfurl="true"]www.mydomain.com/images/bannerimage"[/URL] alt="the alt description"></a>';
$output=htmlentities($mystring);
echo $output;

----------------------------------
Ignorance is not necessarily Bliss, case in point:
Unknown has caused an Unknown Error on Unknown and must be shutdown to prevent damage to Unknown.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top