Connecting Tech Pros Worldwide Forums | Help | Site Map

str_replace & regular expressions question

Mickey
Guest
 
Posts: n/a
#1: May 13 '06
Hi folks,

I am just writing to ask for help with something i'm trying to do with
a string.

I have a filename, for instance 'file.txt'.
However i'd like to make a script to take that file name and return it
as something like:
<a href= javascript:function('file.txt')>file.txt</a><br />

I have tried using PHP's str_replace function but I still can't seem to
get it right.

Does anyone know what I need to do to accomplish this?

Thank you all in advance.

Mikey


Vincent Courcelle
Guest
 
Posts: n/a
#2: May 13 '06

re: str_replace & regular expressions question


Mickey a écrit :
[color=blue]
> I have a filename, for instance 'file.txt'.
> However i'd like to make a script to take that file name and return it
> as something like:
> <a href= javascript:function('file.txt')>file.txt</a><br />[/color]

Hello,
It seems to easy to be what you expect but I try :
function getLink($filename)
{return "<a
href=\"javascript:function('".$filename."')\">".$f ilename."</a><br />";}

--
Vincent Courcelle
http://www.tubededentifrice.com et http://www.france-jeunes.net

Mickey
Guest
 
Posts: n/a
#3: May 13 '06

re: str_replace & regular expressions question


Thank you Vincent for that.
That solution was blatantly obvious. I can't believe I didn't see it.

Thank's again for the help.

Kind Regards,
Mikey

Closed Thread