Jump to content


WIKI: [[text]] will equal link


5 replies to this topic

#1 b3nji

    Young Padawan

  • Members
  • Pip
  • 14 posts

Posted 21 January 2006 - 07:09 PM

Hey all

I am coding my own wiki for my new site. At the moment i can make new wiki (if the tag does not exist) and i can edit posts.

Now what i want to be able to do is is say a user in the wiki posted [[text]] it will return as a link to the wiki tag.

How can i make this happen? how can i make [[text]] turn into <a href='wiki.php?tag=test'>text</a> ?

thanks all

#2 rc69

    PHP Master PD

  • P2L Staff
  • PipPipPipPip
  • 3,827 posts
  • Gender:Male
  • Location:Here
  • Interests:Web Development

Posted 21 January 2006 - 07:12 PM

The only thing i know about wiki is wikipedia. I've never done anything but read articles on wiki sites, but i would assume changing [[text]] into a link, would run the same as bbcode. Do a search of the database, and you'll come up with something.

#3 b3nji

    Young Padawan

  • Members
  • Pip
  • 14 posts

Posted 21 January 2006 - 07:19 PM

View Postrc69, on Jan 22 2006, 12:12 AM, said:

The only thing i know about wiki is wikipedia. I've never done anything but read articles on wiki sites, but i would assume changing [[text]] into a link, would run the same as bbcode. Do a search of the database, and you'll come up with something.

will do thanks

:) the tutorials on ur website dont help

well basically i am told i need to make a bb code.

For example.

"This is my [wiki] entry on my website"

how can i get [wiki] to equal: <a href='wiki.php?tag=wiki'>wiki<­ /a>?

#4 HaloprO

    Requires Armed Escort

  • Members
  • PipPip
  • 310 posts
  • Gender:Male
  • Location:California, USA

Posted 22 January 2006 - 12:19 AM

With php you can do:
<?php
echo preg_replace("/\[(.*)\]/", '<a href="wiki.php?tag=$1">$1</a>', 'This is my [wiki] entry on my website');
?>
Haven't tested it but it should work.

#5 rc69

    PHP Master PD

  • P2L Staff
  • PipPipPipPip
  • 3,827 posts
  • Gender:Male
  • Location:Here
  • Interests:Web Development

Posted 22 January 2006 - 12:45 PM

View Postb3nji, on Jan 21 2006, 07:12 PM, said:

:D the tutorials on ur website dont help
As far as i know, i don't have any bbcode tutorials on my website. And i can't say why you were looking there, but heres a link to what i was telling you to look at.
http://www.pixel2life.com/tutorials/PHP_Co...1&d=1&ss=bbcode

Although, if you don't feel like sorting through that list of tutorials, i believe halopr0's code should work just fine.

p.s. Please don't triple post, use the edit button.

Edited by rc69, 22 January 2006 - 12:46 PM.


#6 HaloprO

    Requires Armed Escort

  • Members
  • PipPip
  • 310 posts
  • Gender:Male
  • Location:California, USA

Posted 22 January 2006 - 01:46 PM

I've never seen a triple post before... :D
And I think he thought that Pixel2Life was your website..





1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users