The Arcive of Official vBulletin Modifications Site.It is not a VB3 engine, just a parsed copy! |
|
#1
|
|||
|
|||
MySQL DB query from BBCode possible?
I have a separate DB on the same server as my forum, and would like to offer my users the ability to query that DB from BBCode in their posts.
It's a gaming site, and we maintain a database of the skills in the game, and then frequently post builds on the forums. So ideally, a user would be able to write [skill]Sprint[/skill] and this would be parsed in the post as the icon, description, cost etc. Is this possible? I haven't been able to figure out how to get PHP into the custom BBCodes. Can anyone point me in a good direction to learn about this? Thanks, -Daniel |
#2
|
||||
|
||||
You would have to use one off the bbcode hooks (I believe). I haven't tried this, but that would be it if it was anywhere.
|
#3
|
||||
|
||||
Been there, done that. I run a gaming site, and that's pretty much how I use bbcode.
Can't tell you how to do it with hooks, since I don't use them, but if you look at how the class is structured, its pretty easy to write a callback that does a db call |
#4
|
|||
|
|||
Would you mind posting the code you used, please? I'm sure I could reverse-engineer it from that. Or even just what files need adapting....
|
#5
|
||||
|
||||
Just remember the posts are cached, so after it's queried once it will remain as-is for around 7 days, depending on your settings.
|
#6
|
||||
|
||||
I think you can disable caching on a per-post basis, so you can disable it for any posts that contain this BBCode.
|
#7
|
||||
|
||||
The caching is a good thing. Within this context, the content of the expanded tag is not going to change.
Quote:
|
#8
|
|||
|
|||
Thanks, I was able to sort it out. After some studying of the class_bbcode.php file, it was (as you said) surprisingly easy. It's all about formatting from here on out.
|
|
|
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
More Information | |
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|