The Arcive of Official vBulletin Modifications Site.It is not a VB3 engine, just a parsed copy! |
|
#1
|
|||
|
|||
Preg_Replace with Links?
Here's the plugin I'm working on:
Product: vBulletin Hook Location: postdata_presave Order: 5 PHP Code:
Any ideas on how to make this work? |
#2
|
||||
|
||||
If it's in the postbit, how about using hook postbit_display_complete
|
#3
|
||||
|
||||
More of a description as to what exactly you're trying to do would help as well
|
#4
|
|||
|
|||
@Lynne: It doesn't seem to work; the terms aren't being replaced, but I appreciate the suggestion!
postbit_display_start seems to work as far as getting the search/replace to work, but the links aren't parsed. @HMBeaty: Sorry, I should have made it clearer: I'm trying to link specific keywords within posts using preg_replace(). Full story: I run a Pokemon Card website, so I'm trying to automatically link card names to a database website so people can quickly look them up. I made a plugin for my WordPress portion of the site which works great, and I'm trying to port it over to vB. I need to use CSS to style the links to make them look different than normal hyperlinks for convenience of my readers, so they can differentiate the types of links quickly. |
#5
|
|||
|
|||
These 3 things might help..
1) Try doing it in the bbcode_parse_start hook. 2) Clear $parsedtext by using $parsedtext = '' before your replacements. If you don't do that, the posts will always show what's in the postparsed cache. 3) Use the URL BB Code for the replacement, not HTML <a href. The word will automatically become a link in the post which should make it stand out from the rest. |
#6
|
|||
|
|||
Thanks for the ideas nhawk!
I tried bbcode_parse_start but that didn't work, and $parsedtext = '' also seemed to have no effect. The only success I've had so far with getting the replacements to work has been with these hooks: postdata_presave threaddata_presave postbit_display_start I may just switch to BB Code rather than try and get the HTML to work... it seems like it should be easy enough to figure this out. I just have so little experience coding in vB. Also by stand out, I mean I want the linked terms to stand out from other links within posts. I use a more subtle link styling on my WordPress install since a bunch of terms might be mentioned in a post, and it looks messy with the default link styling. |
#7
|
||||
|
||||
I have used preg_replace to successfully create links using the postbit_display_complete hook.
PHP Code:
|
Благодарность от: | ||
AdamCap |
#8
|
|||
|
|||
Rock on!!! Thanks so much Lynne!
I think the issue I had before when I tried postbit_display_complete was that I was using: PHP Code:
PHP Code:
|
#9
|
|||
|
|||
Sorry for bumped old thread...
I try to make replace url`s from our own clowd into image with this url. Then I use hook postbit_display_complete with this code: PHP Code:
If I use hook postdata_presave with slightly changed code: PHP Code:
So... I`m not deeper coder of vB, and I hope somebody help me with correct code for my module. Thanks anyway! |
|
|
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
More Information | |
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|