Mabinogi Guru
MainMabiBlogForumsMabinogi WikiImage GalleryArcadeFlash Chat

Navbar Left Navbar Right

Mabinogi Guru Forums » Mabinogi Guru Fansite » Tip Box » Wikilinks in the Forums?

Reply
Tcat Left
 
LinkBack Thread Tools Display Modes
Thead Left Old 02-15-2008, 01:14 AM   #11 (permalink) Thead Left
Administrator
 
Itchy's Avatar
 
Join Date: Dec 2007
Posts: 547
My Mood:
Gold: 29,971
Itchy has a spectacular aura aboutItchy has a spectacular aura aboutItchy has a spectacular aura aboutItchy has a spectacular aura aboutItchy has a spectacular aura aboutItchy has a spectacular aura aboutItchy has a spectacular aura about
Default

Wow, you actually did it.

So basically what does this function do before I test it on the server? Does it add the "Wiki" bbcode? Don't you need to edit some files in the Wiki as well to make it work?
__________________

The Cool Mabinogi Fansite - Use this Mabisiggy | Love the Guru? You can show your support by donating!
Itchy is offline   Reply With Quote
Thead Left Old 02-15-2008, 01:20 AM   #12 (permalink) Thead Left
Supporter
 
Join Date: Feb 2008
Posts: 358
Gold: 3,062
Hark will become famous soon enoughHark will become famous soon enoughHark will become famous soon enoughHark will become famous soon enough
Default

It isn't bbcode, really. It's a regex replacement.

Simply put, it scans the post for "[[something]]", (or the other version, the [[something|something else]]) then replaces all instances of that with the URL bbcodes which then get parsed later on in the function. It's a fairly straightforward implementation.

So when it finds a post like [[fishing]] it will see replace the double brackets with [url]http://www.mabiguru.com/wiki/index.php?title=fishing[/url]. Then the [url] bbcode gets picked up by the forum code and turned into links like http://www.mabiguru.com/wiki/index.php?title=fishing (as if it had been typed in directly).

I honestly can't really explain how it works short of pointing you to a couple regular expression tutorials :x

Last edited by Hark : 02-15-2008 at 01:25 AM. Reason: lol escaping tags
Hark is offline   Reply With Quote
Thead Left Old 02-15-2008, 01:27 AM   #13 (permalink) Thead Left
Administrator
 
Itchy's Avatar
 
Join Date: Dec 2007
Posts: 547
My Mood:
Gold: 29,971
Itchy has a spectacular aura aboutItchy has a spectacular aura aboutItchy has a spectacular aura aboutItchy has a spectacular aura aboutItchy has a spectacular aura aboutItchy has a spectacular aura aboutItchy has a spectacular aura about
Default

Amazing, now I saw the code and see your point. Looks good!

Will be testing in a few..
__________________

The Cool Mabinogi Fansite - Use this Mabisiggy | Love the Guru? You can show your support by donating!
Itchy is offline   Reply With Quote
Thead Left Old 02-15-2008, 01:35 AM   #14 (permalink) Thead Left
Administrator
 
Itchy's Avatar
 
Join Date: Dec 2007
Posts: 547
My Mood:
Gold: 29,971
Itchy has a spectacular aura aboutItchy has a spectacular aura aboutItchy has a spectacular aura aboutItchy has a spectacular aura aboutItchy has a spectacular aura aboutItchy has a spectacular aura aboutItchy has a spectacular aura about
Default

Ok let us try it..

http://www.mabiguru.com/wiki/index.php?title=Fishing

It seems like it changes the whole URL to the wiki URL. Maybe we could apply some conditions and make the link appear like an ordinary link.
__________________

The Cool Mabinogi Fansite - Use this Mabisiggy | Love the Guru? You can show your support by donating!
Itchy is offline   Reply With Quote
Thead Left Old 02-15-2008, 01:41 AM   #15 (permalink) Thead Left
Supporter
 
Join Date: Feb 2008
Posts: 358
Gold: 3,062
Hark will become famous soon enoughHark will become famous soon enoughHark will become famous soon enoughHark will become famous soon enough
Default

Ack, I'm a retard. In the first preg_replace, change

'[url]http://www.mabiguru.com/wiki/index.php?title=$1[/url]'

to

'[url=http://www.mabiguru.com/wiki/index.php?title=$1]$1[/url]'

and that should do the trick. Also, it's really weird that it didn't show [[fishing]] when I quoted your post - instead it showed the bbcode. I have no idea why it would do that (unless your post was made with the bbcode rather than the [[]]-syntax :P)

EDIT: Huh, when I edit my own post it shows [[fishing]]. lulz.
Yay
Hark is offline   Reply With Quote
Thead Left Old 02-15-2008, 01:49 AM   #16 (permalink) Thead Left
Administrator
 
Itchy's Avatar
 
Join Date: Dec 2007
Posts: 547
My Mood:
Gold: 29,971
Itchy has a spectacular aura aboutItchy has a spectacular aura aboutItchy has a spectacular aura aboutItchy has a spectacular aura aboutItchy has a spectacular aura aboutItchy has a spectacular aura aboutItchy has a spectacular aura about
Default

It seems like it's case-sensitive.
__________________

The Cool Mabinogi Fansite - Use this Mabisiggy | Love the Guru? You can show your support by donating!
Itchy is offline   Reply With Quote
Thead Left Old 02-15-2008, 01:51 AM   #17 (permalink) Thead Left
Supporter
 
Join Date: Feb 2008
Posts: 358
Gold: 3,062
Hark will become famous soon enoughHark will become famous soon enoughHark will become famous soon enoughHark will become famous soon enough
Default

What do you mean? I think MediaWiki might be case-sensitive with respect to article names, but I can't quite remember.

* tests fishing, test

I'm sure the updated regex is right.
Hark is offline   Reply With Quote
Thead Left Old 02-15-2008, 01:52 AM   #18 (permalink) Thead Left
Administrator
 
Itchy's Avatar
 
Join Date: Dec 2007
Posts: 547
My Mood:
Gold: 29,971
Itchy has a spectacular aura aboutItchy has a spectacular aura aboutItchy has a spectacular aura aboutItchy has a spectacular aura aboutItchy has a spectacular aura aboutItchy has a spectacular aura aboutItchy has a spectacular aura about
Default

Quote:
Originally Posted by Hark View Post
Err, nevermind.

fishing and Fishing

EDIT: Works now, can we have the output text in bold? Or maybe we can add a small image beside the word to indicate that it's a wiki article. Is it possible to add the conditionals in the class_bbcode file?

+rep to you Hark!
__________________

The Cool Mabinogi Fansite - Use this Mabisiggy | Love the Guru? You can show your support by donating!
Itchy is offline   Reply With Quote
Thead Left Old 02-15-2008, 01:57 AM   #19 (permalink) Thead Left
Supporter
 
Join Date: Feb 2008
Posts: 358
Gold: 3,062
Hark will become famous soon enoughHark will become famous soon enoughHark will become famous soon enoughHark will become famous soon enough
Default

lulz, according to this, MediaWiki is case-insensitive with respect to the first letter of article names (since it forces the first letter to always be upper-case), but case-sensitive with respect to the rest of it.

So fishing = Fishing != FISHING.

Thanks a ton for implementing this, I'm really happy to finally see a forum which actually supports easy linking to it's own wiki
Hark is offline   Reply With Quote
Thead Left Old 02-15-2008, 07:26 AM   #20 (permalink) Thead Left
Wiki Squad
 
Bakuryu's Avatar
 
Join Date: Feb 2008
Posts: 1,509
Gold: 9,116
Bakuryu is a jewel in the roughBakuryu is a jewel in the roughBakuryu is a jewel in the roughBakuryu is a jewel in the roughBakuryu is a jewel in the roughBakuryu is a jewel in the roughBakuryu is a jewel in the roughBakuryu is a jewel in the roughBakuryu is a jewel in the rough
Send a message via MSN to Bakuryu
Default

*tests*
Fishing


wut, awesome job
__________________
Bakuryu~
Bakuryu is online now   Reply With Quote
Bottom LeftBottom Right

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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
SEO by vBSEO 3.1.0
vBCredits v1.4 Copyright ©2007, PixelFX Studios
Skin by CompletevB