The Arcive of Official vBulletin Modifications Site.It is not a VB3 engine, just a parsed copy! |
|
#1
|
|||
|
|||
Php/mysql code in VBulletin templates
Hi everybody!
I want to make a modification to my forum. I don't want to bore you with all the details. For now I added a "my_keyword" to thread table in the database, and now I just want to display it next to the thread title. In forumhome_forumbit_level2_post I did this: Code:
<td class="alt1Active" align="$stylevar[left]" id="f$forum[forumid]"> <div> $rr = $vbulletin->$db->query_first("SELECT oras FROM af_thread WHERE userid = " . $forum[forumid] . "); <a href="forumdisplay.php?$session[sessionurl]f=$forum[forumid]"><strong>$forum[title] - $rr </strong> So, my question is: How to make it work? |
#2
|
|||
|
|||
vBulletin limits what you can do in a template, I guess the idea is that you could let a "designer" (or whatever you want to call it) work on the appearance of the site without doing anything "dangerous". So for most coding beyond a simple if condition you need to create a plugin. (I think you might be able to do a little more in a template in vB4, but I don't remember for sure).
Anyway, you can just copy your line of code to the plugin, the problem is chooing a hook location. You pretty much have to go to the source code and figure out where your template is being evaluated, then find a hook location that gets eval'd before that. In your case you probably need to find the loop generating the forums and find a location inside the loop. A good place to start is to look at which php file is generating the page. (Of course if you can't find a hook location to do what you want there's nothing stopping you from changing the php file directly, but if you ever go to rebuild your site or upgrade you'll probably wish you hadn't gone that way). Hope this helps. |
|
|
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
More Information | |
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|