Connecting Tech Pros Worldwide Help | Site Map

str_replace & regular expressions question

 
LinkBack Thread Tools Search this Thread
  #1  
Old May 13th, 2006, 05:25 PM
Mickey
Guest
 
Posts: n/a
Default str_replace & regular expressions question

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


  #2  
Old May 13th, 2006, 05:45 PM
Vincent Courcelle
Guest
 
Posts: n/a
Default 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

  #3  
Old May 13th, 2006, 06:15 PM
Mickey
Guest
 
Posts: n/a
Default 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

 

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Popular Articles

What is Bytes?

We are a network of experts and professionals in IT and software development that help one another with answers to tough questions and share insights. Get the best answers to your questions from over 220,989 network members.