GIDForums  

Go Back   GIDForums > Computer Programming Forums > MySQL / PHP Forum
User Name
Password
Register FAQ Members List Calendar Search Today's Posts Mark Forums Read

 
 
Thread Tools Search this Thread Rate Thread
  #11  
Old 03-Mar-2005, 13:56
leegold leegold is offline
New Member
 
Join Date: Mar 2005
Posts: 2
leegold is on a distinguished road

autolink question


Tried the code on:
www.gidforums.com

See the source from running the example below, the last link is not fully processed - is there a fix?

For more information, visit our website <a href="http://www.desilva.biz" target="_blank">http://www.desilva.biz</a> or <a href="www.gidforums.com/" target="_blank">www.gidforums.com/</a> to discuss this. This topic is discussed here: <a href="http://www.gidforums.com/t" target="_blank">http://www.gidforums.com/t</a>-1787.html
  #12  
Old 04-Mar-2005, 06:15
JdS's Avatar
JdS JdS is offline
Senior Member
 
Join Date: Aug 2001
Location: KUL, Malaysia
Posts: 3,371
JdS will become famous soon enough
Thank you for the feedback leegold. I have not looked at this snippet of code in a long time and I will surely review it as soon as possible.
  #13  
Old 04-Mar-2005, 08:01
JdS's Avatar
JdS JdS is offline
Senior Member
 
Join Date: Aug 2001
Location: KUL, Malaysia
Posts: 3,371
JdS will become famous soon enough
I made changes to fix this error plus I added the ability to control the rel="nofollow" attribute in the links created by this code.

FYI, all 3 custom functions were modified today.

As usual, I'll apreciate any feedback. http://www.gidforums.com/t-1816.html.
  #14  
Old 28-Apr-2005, 16:36
gilahacker gilahacker is offline
New Member
 
Join Date: Apr 2005
Posts: 1
gilahacker is on a distinguished road

problem with your script


Quote:
Originally Posted by JdS
I made changes to fix this error plus I added the ability to control the rel="nofollow" attribute in the links created by this code.

FYI, all 3 custom functions were modified today.

As usual, I'll apreciate any feedback. http://www.gidforums.com/t-1816.html.

your script seems to work fine for plain text url's but doesn't seem to work for email addresses. Also if it runs into a url that's already a link it tries to make it a link again, resulting in problems.

I've thought of doing a php strip_tags before passing the text to the function but that would kill links like <a href="http://www.google.com">the number one search engine</a> and they'd be gone forever with no way of putting them back.

I've got a site where people post articles and they have a "resource box" at the bottom of their article that tells about them and has a link to their website and sometimes an email address. Problem is that sometimes they make their url a link and sometimes they don't, same with the email address.

It would be great if this function skipped over anything already in html tags (i.e. ignore anything between "<a" and "</a>" and only made plain-text urls into hyperlinks. Same for the email addresses.

Thank you for your work on this so far. If I knew php better I'd offer help but for now all I can offer is suggestions.

-Jason
www.articleblast.com
  #15  
Old 01-May-2005, 22:27
w00dy w00dy is offline
New Member
 
Join Date: May 2005
Posts: 1
w00dy is on a distinguished road
Here is a quick and dirty way to acheive a good deal of efficiency (not including email addresses)

Quote:
$maincontent = "blah blah blah www.somesitethatexists.com blah blah blah blah";

function preghref($strText) {
return preg_replace( '/(http|ftp|https|irc)+(s)?\/\/)((\w|\.)+)(\/)?(\S+)?/i', '<a href="\0">\4</a>', $strText );
}

echo preghref($maincontent);
  #16  
Old 08-Jan-2008, 05:18
andy_vdg andy_vdg is offline
New Member
 
Join Date: Jan 2008
Posts: 1
andy_vdg is on a distinguished road

Re: Clickable web-urls from database.


Good script but it doesn't seem to work for .ch TLD's. Also being able to convert email addresses would be great. It also seems to have problems with foreign characters. E.g. if there is code for ü
HTML Code:
&uuml;
in the string it will just display &uuml; without converting it.
 
 

Recent GIDBlogProgramming ebook direct download available by crystalattice

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Rate This Thread
Rate This Thread:

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

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Parsing PHP code that's stored in a database. JdS MySQL / PHP Forum 3 13-May-2004 10:15
Redirect multiple URLs to one script, masking true URL Maccaday Apache Web Server Forum 1 10-Dec-2003 09:34
WInXp Apache database? Ticoloco Apache Web Server Forum 1 27-Nov-2003 05:21
[Tutorial] MySQL Basics nniehoff MySQL / PHP Forum 15 23-Mar-2003 20:42
Generating simple URLs for search engines jrobbio MySQL / PHP Forum 1 17-Mar-2003 12:22

Network Sites: GIDNetwork · GIDWebHosts · GIDSearch · Learning Journal by J de Silva, The

All times are GMT -6. The time now is 18:11.


vBulletin, Copyright © 2000 - 2009, Jelsoft Enterprises Ltd.