What happened to the Messenger Plus! forums on msghelp.net?
Shoutbox » MsgHelp Archive » Skype & Technology » Tech Talk » PHP help

PHP help
Author: Message:
-dt-
Scripting Contest Winner
*****

Avatar
;o

Posts: 1819
Reputation: 74
36 / Male / Flag
Joined: Mar 2004
RE: RE: PHP help
quote:
Originally posted by Ezra
quote:
Originally posted by -dt-

code:
$string = preg_replace('/\[\[wiki(?:\:|)([a-zA-Z]+|)\]([a-zA-z0-9_]+)\]/e', 'defL("$1","$2")',$string);

    function defL($lang,$title){
    if($lang=='')$lang='en';
    $title1 = str_replace("_", " ", $title);
    return '<a href="http://'.$lang.'.wikipedia.org/wiki/'.$title.'">'.$title1.'</a>';
    }


Found a little error, fixed it

Instead of using the parts defined in the tag it made a link like this:
<a href="$lang.wikipedia.org/wiki/$title">$title1</a>


WTf please tell me how it would return a link like that

my code
code:

$string = preg_replace('/\[\[wiki(?:\:|)([a-zA-Z]+|)\]([a-zA-z0-9_]+)\]/e', 'defL("$1","$2")',$string);


function defL($lang,$title){
if($lang=='')$lang='en';
$title1 = str_replace("_", " ", $title);
return "<a href='http://$lang.wikipedia.org/wiki/$title'>$title1</a>";
}


because I use " to contain the string which will parse any varible in that string unlike its brother '

:-/ so im not getting how its an error...

This post was edited on 10-02-2005 at 05:15 AM by -dt-.
[Image: dt2.0v2.png]      Happy Birthday, WDZ
10-02-2005 05:14 AM
Profile PM Web Find Quote Report
« Next Oldest Return to Top Next Newest »

Messages In This Thread
PHP help - by Ezra on 09-30-2005 at 05:03 PM
RE: PHP help - by J-Thread on 09-30-2005 at 05:24 PM
RE: PHP help - by Ezra on 09-30-2005 at 05:37 PM
RE: PHP help - by L. Coyote on 09-30-2005 at 06:10 PM
RE: PHP help - by Ezra on 09-30-2005 at 06:16 PM
RE: PHP help - by WDZ on 09-30-2005 at 06:35 PM
RE: PHP help - by Ezra on 09-30-2005 at 06:55 PM
RE: PHP help - by brian on 09-30-2005 at 07:14 PM
RE: PHP help - by Ezra on 09-30-2005 at 08:38 PM
RE: PHP help - by J-Thread on 09-30-2005 at 08:58 PM
RE: PHP help - by Ezra on 09-30-2005 at 10:15 PM
RE: PHP help - by WDZ on 10-01-2005 at 04:03 AM
RE: PHP help - by J-Thread on 10-01-2005 at 08:22 AM
RE: PHP help - by -dt- on 10-01-2005 at 09:29 AM
RE: PHP help - by J-Thread on 10-01-2005 at 11:08 AM
RE: RE: PHP help - by -dt- on 10-01-2005 at 02:11 PM
RE: PHP help - by L. Coyote on 10-01-2005 at 04:16 PM
RE: PHP help - by Ezra on 10-01-2005 at 05:47 PM
RE: RE: PHP help - by -dt- on 10-02-2005 at 05:14 AM
RE: PHP help - by J-Thread on 10-01-2005 at 06:03 PM
RE: PHP help - by Ezra on 10-02-2005 at 12:59 PM


Threaded Mode | Linear Mode
View a Printable Version
Send this Thread to a Friend
Subscribe | Add to Favorites
Rate This Thread:

Forum Jump:

Forum Rules:
You cannot post new threads
You cannot post replies
You cannot post attachments
You can edit your posts
HTML is Off
myCode is On
Smilies are On
[img] Code is On