vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB3 Programming Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=15)
-   -   MySQL DB query from BBCode possible? (https://vborg.vbsupport.ru/showthread.php?t=162625)

sof-guild 11-13-2007 05:16 PM

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

King Kovifor 11-13-2007 10:36 PM

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.

Eikinskjaldi 11-14-2007 02:44 AM

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

sof-guild 11-14-2007 03:42 AM

Quote:

Originally Posted by Eikinskjaldi (Post 1382154)
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

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....

Adrian Schneider 11-14-2007 03:51 AM

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.

Analogpoint 11-14-2007 01:55 PM

I think you can disable caching on a per-post basis, so you can disable it for any posts that contain this BBCode.

Eikinskjaldi 11-15-2007 12:35 AM

The caching is a good thing. Within this context, the content of the expanded tag is not going to change.

Quote:

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....
The file that needs changing is class_bbcode.php. Other than that, I am afraid I consider my implementation a trade secret. Gotta have some edge over the competition. I was basically just posting to let you know it is possible

sof-guild 11-15-2007 05:20 AM

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
  • Page Generation 0.01485 seconds
  • Memory Usage 1,725KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (2)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (8)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • printthread_start
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete