|
|
#1 (permalink) |
|
Surpass Fan
Super #1
|
Twitter @replies
I am looking for a PHP function that can convert
replies in a string to a link leading to their profile.I have already found a function to convert plain text to URLs when "http://" or "www." is present, but I can't find a working one for replies. I found one that didn't seem to do anything at all, and I think I'm just not using the right keywords.Basically I want " robmonroe" to be converted to:Code:
@<a href="http://twitter.com/robmonroe">robmonroe</a>
__________________
fury™ - not helping the situation since 1987 robmonroe.net | Twitter | Foursquare |
|
|
|
|
|
#3 (permalink) |
|
Surpass Fan
Super #1
|
Kevin Smith PHP: Autolink Text - Twitter
repliesThis was the one that I found. But it doesn't work.
__________________
fury™ - not helping the situation since 1987 robmonroe.net | Twitter | Foursquare |
|
|
|
|
|
#4 (permalink) |
|
Race Surpass
Super #1
Joined in Jul 2006
Lives in Oklahoma City, OK
Hosted on sh102
1,510 posts
Gave thanks: 21
Thanked 104 times
|
Okay, here's what I got based on that code.. the only thing it misses is a
username that is at the end of a string.PHP Code:
username that comes at the end of the string. They way they had it coded, it was replacing what it found with itself so it didn't actually change anything LOL. |
|
|
|
|
|
#5 (permalink) |
|
Race Surpass
Super #1
Joined in Jul 2006
Lives in Oklahoma City, OK
Hosted on sh102
1,510 posts
Gave thanks: 21
Thanked 104 times
|
Well, this would probably work better to just pass the string with the extra space attached, since this doesn't modify the original value in $tweet
PHP Code:
|
|
|
|
|
|
#6 (permalink) |
|
Surpass Fan
Super #1
|
I think I did it on my own. I looked at how to use preg_replace, because I never have before..
PHP Code:
__________________
fury™ - not helping the situation since 1987 robmonroe.net | Twitter | Foursquare |
|
|
|
|
|
#7 (permalink) |
|
Surpass Fan
Super #1
|
I just realized that this works for people with alphanumeric names, but not underscores which are allowed by Twitter. I think that's all they allow though, right? a-z, 0-9, and _.
__________________
fury™ - not helping the situation since 1987 robmonroe.net | Twitter | Foursquare |
|
|
|
|
|
#8 (permalink) |
|
Surpass Fan
Super #1
|
And this only seems to work with the first one, not multiples...
__________________
fury™ - not helping the situation since 1987 robmonroe.net | Twitter | Foursquare |
|
|
|
|
|
#9 (permalink) |
|
Surpass Fan
Super #1
|
Yours works! Thanks a ton.
__________________
fury™ - not helping the situation since 1987 robmonroe.net | Twitter | Foursquare |
|
|
|
![]() |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | Search this Thread |
| Rate This Thread | |
|
|