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 Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to make url as a clickable link using echo fn or other fns 1

Status
Not open for further replies.

amirkhansemail

Programmer
Jan 22, 2007
11
CA
Hello,

My problem is if i say for eg:

Code:
echo "[URL unfurl="true"]http://www.cnn.com";[/URL]

it shows as plain text not as a link on the browser, so the question is how to make it appear as a clickable link WITHOUT using anchor href. Because on my site people are filling textarea box with the some other text, but when they enter a link as part of the text it just shows as plain text.

is there a function in php with the help of which we can make an http tag a link?

Your help is highly appreciated.

Thanks and best regards,
Amir Khan
 
You'll have to search for the strings, and then interpolate the href tags on the fly to make it a link. Browsers will not render a link unless it is surrounded by <a href> tags.


Using some string functions such as preg_replace, or preg_match you should be able to add the required html to make the links.

In the php online manual page for the preg_replace() function one of the user supplied notes has a function to do what you want. Click here for the preg_replace() entry in the php online manual


----------------------------------
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