PDA

View Full Version : How do I display vb Database information in a template?


acanuck
27 Dec 2009, 04:35
I installed this side column mod onto my forum:'
http://www.vbulletin.org/forum/showthread.php?t=229496

Now I have a template called 'ss_rightcolumn_contents" where I can add content that I want to display in that column.

I have been trying to display information from the "forum" table of the database but so far have been unsuccessful. Here is some of the code I tried putting in the template:




forum{vb:raw forum.forumid}

or

$foruminfo['forumid']

or

{vb:raw foruminfo.forumid}


All these didn't work.

I'm looking for someone to help tell me what I need to do to be able to display forum information in the side column.

Please let me know if you know the solution.

I can also pay a small donation for helping me out with this!

Thanks :)

Lynne
27 Dec 2009, 04:46
Questions regarding modifications need to be asked in the modification thread.

One thing to help.... look at the other templates used on that page and see what variables are used there. Or, look at the php page being called and see what variables are being used there.

acanuck
27 Dec 2009, 04:57
Thanks Lynne :-)

Generally speaking though, regardless of this particular mod, how can I extract information from vb tables to display in any template?

Lynne
27 Dec 2009, 05:00
First you would need to query the database to get the information, then assign the results to a variable and then use the variable in the template, usually like {vb:raw array.name}

acanuck
27 Dec 2009, 05:21
First you would need to query the database to get the information, then assign the results to a variable and then use the variable in the template, usually like {vb:raw array.name}

Thanks :)

So I'd need to create a plugin with the php query and variable declaration?

Lynne
27 Dec 2009, 17:05
Yes, if the query has not already been made. There are also hooks you can use to 'plugin' to existing queries if you just need to add a couple of fields to a query.