Jump to content


bbcode question


7 replies to this topic

#1 Hayden

    P2L Jedi

  • Members
  • PipPipPip
  • 716 posts
  • Gender:Male
  • Location:Texas

Posted 08 October 2005 - 07:28 PM

http://www.pixel2life.com/forums/index.php...t=0&#entry79888

so, i've been playing around with the php code from that thread. very cool btw :)


but what i haven't been able to figure out is...

how do i do the code so that when a fully qualified address shows up (http://www.google.com), not encapsulated in bbcode tags, it automatically applies the <a href=""></a> html tags around it?



http://www.google.com

hmmm, kinda like it did here i think. mebbe i need to go check my ipb source.

Edited by SpaceGhost, 09 October 2005 - 11:36 AM.


#2 Chaos King

    Senior Programmer

  • P2L Staff
  • PipPipPip
  • 676 posts
  • Gender:Male
  • Location:Florida

Posted 08 October 2005 - 08:37 PM

SpaceGhost, on Oct 8 2005, 07:28 PM, said:

http://www.pixel2lif...indpost&p=79888

so, i've been playing around with the php code from that thread. very cool btw :(


but what i haven't been able to figure out is...

how do i do the code so that when a fully qualified address shows up (http://www.google.com), not encapsulated in bbcode tags, it automatically applies the html tags around it?http://www.google.com

hmmm, kinda like it did here i think. mebbe i need to go check my ipb source.
Link is broken :)

#3 Hayden

    P2L Jedi

  • Members
  • PipPipPip
  • 716 posts
  • Gender:Male
  • Location:Texas

Posted 08 October 2005 - 09:33 PM

huh? :huh:

#4 rc69

    PHP Master PD

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

Posted 08 October 2005 - 10:47 PM

Looking at your IPB source would be a smart thing. Although i find source wrote by others (more specifically people who know more about what they're doing then they should), tends to be semi-confusing.
Try a preg_match/replace http://php.net/manua...tern.syntax.php
preg_match('#http://[a-z0-9\-_\./]\.[a-z]#i', $text, $match);
You can probably find a tutorial for a url verifier or something similar that would work better then that (almost garanteed).

#5 Hayden

    P2L Jedi

  • Members
  • PipPipPip
  • 716 posts
  • Gender:Male
  • Location:Texas

Posted 09 October 2005 - 03:25 AM

yeah, i was trying to find someway to work it into the function in the tutorial link at the top.

#6 rc69

    PHP Master PD

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

Posted 09 October 2005 - 11:10 AM

SpaceGhost, on Oct 8 2005, 05:28 PM, said:

As chaos king said, the link is broken... Which is why you should probably test it, and then find the correct link, so i can tell you how to work it in...

#7 Hayden

    P2L Jedi

  • Members
  • PipPipPip
  • 716 posts
  • Gender:Male
  • Location:Texas

Posted 09 October 2005 - 11:35 AM

:D wtf!


it worked not 2 days ago.


*goes to find* :rolleyes:

----
http://www.pixel2life.com/forums/index.php...t=0&#entry79888


the forum chopped up the url before


hmmm, i see what happened. :P

double post merged ~rc69

#8 rc69

    PHP Master PD

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

Posted 09 October 2005 - 03:23 PM

$search = array(
    '#(http://[a-z0-9\-_\.]\.[a-z])'
);
$replace = array(
    '<a href="\\1" target="_blank">\\1</a>'
);
That'd be my best guess... Yet again, look for a better url verifier then what i gave.

And don't double post...





1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users