Go Back   RunUO - Ultima Online Emulation > Developer's Corner > Programming > Script Languages

Script Languages Perl/PHP/Python/Ruby so on and so forth.

Reply
 
Thread Tools Display Modes
Old 01-27-2007, 02:38 PM   #1 (permalink)
Forum Expert
 
Nott32's Avatar
 
Join Date: Feb 2006
Location: In front of my computer...
Age: 16
Posts: 562
Send a message via MSN to Nott32 Send a message via Yahoo to Nott32
Default [NEED HELP/SCRIPT] Automatic HTML Link maker

I have a script that will feed all the latest news posted in a specified topic of my phpBB forum but it does not automatically parse links. Is there a easy to use add on for my website that will automatically parse any links that have http://... in them? It needs to be easy to add to my website and does not need to have anything to do with phpBB.
__________________
Everytime a puppy gets hit by a car from me smoking I take another drag, point, and laugh.
Nott32 is offline   Reply With Quote
Old 01-27-2007, 03:40 PM   #2 (permalink)
Forum Expert
 
mordero's Avatar
 
Join Date: Nov 2003
Location: Illinois, USA
Age: 21
Posts: 2,911
Default

this will parse most http:// links, but im sure i forgot some characters to check. Also it doesnt really check if the links are actuall links, just if they look like a link.
example:
PHP Code:
$string "so whats up in the house. here is a link http://www.google.com/ http://www.mordero.com";
$string preg_replace"@(http://[a-zA-z0-9\.]*[/a-zA-z0-9\.?=&%~]*)@i"'<a href="\1">\1</a>'$string );
print 
$string
would output

Code:
so whats up in the house. here is a link <a href="http://www.google.com/">http://www.google.com/</a><a href="http://www.mordero.com">http://www.mordero.com</a>
mordero is offline   Reply With Quote
Old 01-27-2007, 08:54 PM   #3 (permalink)
Forum Expert
 
Nott32's Avatar
 
Join Date: Feb 2006
Location: In front of my computer...
Age: 16
Posts: 562
Send a message via MSN to Nott32 Send a message via Yahoo to Nott32
Default

Thanks mordero :-)

EDIT: Danm me no can givy u Karma :*
__________________
Everytime a puppy gets hit by a car from me smoking I take another drag, point, and laugh.
Nott32 is offline   Reply With Quote
Old 01-27-2007, 10:03 PM   #4 (permalink)
Forum Expert
 
mordero's Avatar
 
Join Date: Nov 2003
Location: Illinois, USA
Age: 21
Posts: 2,911
Default

yep no problem and you might want to test that against some more URLs that you can think of and make sure it works and if not just tell me what they are and ill adjust it.
mordero is offline   Reply With Quote
Old 01-28-2007, 01:30 AM   #5 (permalink)
Forum Expert
 
Nott32's Avatar
 
Join Date: Feb 2006
Location: In front of my computer...
Age: 16
Posts: 562
Send a message via MSN to Nott32 Send a message via Yahoo to Nott32
Default

Yea I noticed that the script will parse anythig withe the [url.][/url.] but not straight links, the script worked perfect I may use this on other scripts (credit where due).
__________________
Everytime a puppy gets hit by a car from me smoking I take another drag, point, and laugh.
Nott32 is offline   Reply With Quote
Old 01-28-2007, 01:35 AM   #6 (permalink)
Forum Expert
 
mordero's Avatar
 
Join Date: Nov 2003
Location: Illinois, USA
Age: 21
Posts: 2,911
Default

hmmm it will parse what but not what?
mordero is offline   Reply With Quote
Old 01-28-2007, 02:40 AM   #7 (permalink)
Forum Expert
 
Nott32's Avatar
 
Join Date: Feb 2006
Location: In front of my computer...
Age: 16
Posts: 562
Send a message via MSN to Nott32 Send a message via Yahoo to Nott32
Default

I meant the news script, your script worked well but it kept messing up my images...like the img code..
__________________
Everytime a puppy gets hit by a car from me smoking I take another drag, point, and laugh.
Nott32 is offline   Reply With Quote
Old 01-28-2007, 03:18 AM   #8 (permalink)
Forum Expert
 
mordero's Avatar
 
Join Date: Nov 2003
Location: Illinois, USA
Age: 21
Posts: 2,911
Default

ahhhh ok, well give me an example of the stuff you want it to look in and replace links in and ill see what i can do
mordero is offline   Reply With Quote
Reply

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

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 On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off



Powered by vBulletin® Version 3.7.0
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
SEO by vBSEO 3.2.0 RC5