Hi, Friday, January 31, 2003, 3:43:52 AM, you wrote: EKAHFe> Hi all!
EKAHFe> Unfortunately, I didn't receive any replies to the problem I sent out EKAHFe> on January 16th so I thought I'd send another email and perhaps EKAHFe> clarify what I am seeing so that maybe someone CAN help and ask EKAHFe> if folks on the list have just not seen this issue before. EKAHFe> The program I am working on allows the customer to view test results EKAHFe> based on a keyword. If the results contain a URL (these URLs are EKAHFe> entered into the MySQL database as straight text), I make it live EKAHFe> using the code snippet below. Unfortunately, I have not been successful EKAHFe> doing this no matter what I try. Currently, after I have run the code EKAHFe> below, what I see is a link containing the correct text but, when you put EKAHFe> the cursor over the link, the actual URL is that of the "base" browser EKAHFe> page. For example, I am working on a file located at: EKAHFe> http://fake.url.com/testing/Test_Results/search_keyword.php EKAHFe> (which is called from form Search_Keyword.php). EKAHFe> If the test results that fit the keyword search contains, say, URL EKAHFe> http://www.cleanrun.com (again, entered into the database as EKAHFe> plain text), this is what will show up in the search output. HOWEVER, EKAHFe> when the cursor is placed over the URL (or the URL is clicked), the EKAHFe> URL that appears at the bottom of the browser corresponding to EKAHFe> the cursor'd URL is http://fake.url.com/testing/Test_Results. EKAHFe> Is there something in my PHP config file I might be missing? Is there EKAHFe> something in my code I'm not doing correctly? Has anyone else ever EKAHFe> seen this problem? EKAHFe> HELP!!! I'm at my wits end with this one. I'm afraid I'm not going to EKAHFe> be able to make these links live which will make the tool much less EKAHFe> usable. Please let me know if you need more information from me in EKAHFe> order to help! EKAHFe> Thanks so much, EKAHFe> Katherine EKAHFe> -----Original Message----- EKAHFe> From: ELLIOTT,KATHERINE A (HP-FtCollins,ex1) EKAHFe> [mailto:[EMAIL PROTECTED]] EKAHFe> Sent: Thursday, January 16, 2003 10:54 AM EKAHFe> To: '[EMAIL PROTECTED]' EKAHFe> Subject: RE: [PHP] Adding HTTP URL Code EKAHFe> Thanks for all your help with my URL code problem! EKAHFe> I have come up with a solution that seems to half work and I can't EKAHFe> figure out what I need to do to get it fully functional. Given my EKAHFe> data string (text) from my database, this is what I do to replace the EKAHFe> URL text with a functioning link. I am asking folks that, if they EKAHFe> include a URL in their results to surround it by [] so that I can search EKAHFe> for the brackets. This is what my text replace line looks like: EKAHFe> $data_str = eregi_replace ("(\[http://)([^]]*)", "<a href \"http=\\0\">>\\0</a>", $data_str); EKAHFe> So, if the URL is (for example) [http://www.cleanrun.com] (in plain text), EKAHFe> it will show up for viewing in my browser as http://www.cleanrun.com EKAHFe> but the URL associated with it will be that of the directory in the browser EKAHFe> "Location" (i.e. http://wrong.url.com/Test_Results). EKAHFe> I've tried all sorts of things with the call to eregi_replace but can't EKAHFe> figure out what is going on. EKAHFe> What the hec??? Can someone help? EKAHFe> Many thanks!! EKAHFe> Katherine Elliott EKAHFe> -----Original Message----- EKAHFe> From: Jason Wong [mailto:[EMAIL PROTECTED]] EKAHFe> Sent: Wednesday, January 08, 2003 2:05 PM EKAHFe> To: [EMAIL PROTECTED] EKAHFe> Subject: Re: [PHP] Adding HTTP URL Code EKAHFe> On Thursday 09 January 2003 04:07, ELLIOTT,KATHERINE A (HP-FtCollins,ex1) EKAHFe> wrote: >> OK, so I've gotten NO responses to my query below so I >> thought I'd ask for something slightly different and see what >> I get. EKAHFe> With regards to your original query, the answer is in the archives. Try EKAHFe> searching for something like "regex url" or "regex hyperlink" etc. EKAHFe> -- Jason Wong ->> Gremlins Associates -> www.gremlins.biz EKAHFe> Open Source Software Systems Integrators EKAHFe> * Web Design & Hosting * Internet & Intranet Applications Development * EKAHFe> /* EKAHFe> NOTICE: alloc: /dev/null: filesystem full EKAHFe> */ EKAHFe> -- EKAHFe> PHP General Mailing List (http://www.php.net/) EKAHFe> To unsubscribe, visit: http://www.php.net/unsub.php EKAHFe> -- EKAHFe> PHP General Mailing List (http://www.php.net/) EKAHFe> To unsubscribe, visit: http://www.php.net/unsub.php I think your regex needs to look like this (from the manual): $data_str = eregi_replace ("\[([[:alpha:]]+://[^<>[:space:]]+[[:alnum:]/])\]", "<a href=\"\\1\">\\1</a>", $data_str); The reason you were getting the wrong link was the href= was wrong so the browser just used the page address as the href. -- regards, Tom -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php