The Arcive of Official vBulletin Modifications Site.It is not a VB3 engine, just a parsed copy! |
|
#1
|
||||
|
||||
Queries on Custom Pages with Multiple Results
I know that the answer exists somewhere.. I just have no idea what I should be searching for.
I have a custom table with userids, win and losses for a game I made. I want to display these results on a custom page using only plugins and templates. I'd rather not create a physical file. Can someone please point me in the right direction? I don't understand how to create a query in the plugin and display it in the template. Thanks. |
#2
|
|||
|
|||
If you don't want to create a new file, you can use a plugin on hook misc_start and have your plugin check for a specific value of $_REQUEST['do'], like:
Code:
if ($_REQUEST['do'] == 'game_stats') { // Format and return your page (such as by calling print_output()). If your plugin // doesn't end the script you will see the list of smilies. } then the url for your page would be misc.php?do=game_stats. To format your page, you would do your query then build a string with the results, then probably use that string in a template, like: Code:
if ($_REQUEST['do'] == 'game_stats') { $results = $vbulletin->db->query("SELECT * FROM game_results ORDER BY ...whatever"); $stats = ""; while ($row = $vbulletin->db->fetch_array($results)) { $stats .= "Wins: $row[wins] Loses: $row[loses]<BR/>"; } // the game_stats template used below would have to be a full html page that includes $stats somewhere. // probably easiest to copy an existing full page template and delete the parts you don't need. eval('print_output("' . fetch_template('game_stats') . '");'); // print_output doesn't return, script ends. } You could also use a small template to format your game stats if you prefer, rather than putting html formatting in your plugin code. |
#3
|
||||
|
||||
You are easily the most helpful person I have ever dealt with on this website. No credit taken away from the others that have helped me.. but you are awesome.
Thank you so much. Works perfectly. |
Благодарность от: | ||
Simon Lloyd |
|
|
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
More Information | |
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|