logo-dw

Go Back   Dreamweaver Club Forums > Hand Coders Forum > Javascript and JS frameworks
Register FAQ Members List Search Today's Posts Mark Forums Read

Reply
 
Thread Tools Display Modes
Old 11-01-2010, 04:11 PM   #1
xglclub
Banned
 
Join Date: Oct 2010
Posts: 2
Default Javascript PHPBB-like URL tag processing

Hi all!
I'm working on a php dynamic web page that has a element that let user write and their text is show in "real time" just javascript-processing the text & tags on a element.
I change the "b","u", and cheap dreamweaver tags between brackets (like phpbb style) to its html equivalent like "strong" ,"u", and so using javascript regexps.
Problem occurs when i need to process the URL tag, when taking URL from [URL=http://.....
How can i replace it to 'a href="http:/..." ' thing?
Thanks in advance

Last edited by edbr; 11-02-2010 at 01:37 AM.. Reason: suspicious link in message
xglclub is offline   Reply With Quote
Old 11-08-2010, 07:09 AM   #2
davidj
davidj's Avatar
 
Join Date: Sep 2005
Location: The Toon (newcastle upon Tyne)
Posts: 8,256
Default IGNORE SOLUTION ABOVE.. iTS BUGGERED!

This works though


PHP Code:
function urlParse($url){
    
    
$patterns = array ('/\[url="/i','/\]/i','/\[\/url/i');
                   
    
$replace = array ('<a href="','>','</a');

    
$link preg_replace($patterns$replace$url);
    
    return 
$link;
    
    }

echo 
urlParse('[url="http://codezenith.co.uk"]link[/url]'); 
__________________
Would you like to learn PHP from me? Check out -> www.codezenith.co.uk
davidj is offline   Reply With Quote
Reply


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

Forum Jump


All times are GMT. The time now is 12:41 PM.


Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2017, vBulletin Solutions, Inc.
Copyright 2006 DreamweaverClub.com