Log in

View Full Version : Custom PHP Page Dynamic Data to template?


blackracoon
06-21-2012, 03:18 PM
Ok so a small issue, I've read up all about creating custom pages within vbulletin 4, however a small issue remains.

What I want to do:

Read from a database a bunch of values and generate a table from it.

The issue:

I know how to pass static data in $vars over to the template to display but, there has to be a better way right to display my generated table. I'm doing a mysql_fetch and adding the whole <tr> string to another string for each value. so I then add <table> the actual content of my table and then the </table> string together, register it, pass it to the template and try to display it. As you can imagine it seems to be causing quite a few issues, where the table gets skewed e.t.c Is there a better way to be doing this? If so how?

Best Regards

kh99
06-21-2012, 03:23 PM
I think what you want to do is to build an array from your query results, register the array to your main template, then use {vb:each} in the template to format it. Here's the manual page for vb:each (at the bottom of the page): https://www.vbulletin.com/docs/html/main/styleref_templates_syntax

blackracoon
06-21-2012, 03:44 PM
Godlike help! Thank you!