![]() |
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 |
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.
|
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 |
Quote:
|
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.
|
I think you can disable caching on a per-post basis, so you can disable it for any posts that contain this BBCode.
|
The caching is a good thing. Within this context, the content of the expanded tag is not going to change.
Quote:
|
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.
|
All times are GMT. The time now is 06:28 AM. |
Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
![]() |
|
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|