Log in

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


acanuck
12-27-2009, 02:35 AM
I installed this side column mod onto my forum:'
https://vborg.vbsupport.ru/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
12-27-2009, 02:46 AM
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
12-27-2009, 02:57 AM
Thanks Lynne :-)

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

Lynne
12-27-2009, 03:00 AM
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
12-27-2009, 03:21 AM
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
12-27-2009, 03:05 PM
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.