PDA

View Full Version : Trying to list ALL entries in 1 column


Zelda-King
02-21-2006, 02:05 PM
I've been attempting to setup a page that includes the display of ALL v3 arcade games (just the titles as an easy reference to what is installed).

I'm playing with the following query for it at the moment;
// Gamecount list
$list = $db->query_read("SELECT arcade_games.title FROM " . TABLE_PREFIX . "arcade_games AS arcade_games WHERE gameid IS NOT NULL GROUP BY arcade_games.title ORDER BY title ASC ");
while ($glist = $db->fetch_array($list)) {
eval('print_output("' . fetch_template('arcade_list') . '");');
However, when I bring it up in the template with $glist[title], only the first entry is shown. Any insight as to what I'm lacking?

Marco van Herwaarden
02-21-2006, 02:18 PM
In general you do something like:
// Process a list and display it using templates
$list = $db->query_read("SELECT ....");
while ($item = $db->fetch_array($list))
{
// Build $mylistbits variable with the information of all returned rows
// The 'mylistbit' template will contain 1 line with the information of $item we want (and line formatting/extra text)
eval('$mylistbits .= "' . fetch_template('mylistbit') . '";');
}

// Now spit out the final template
// The template 'mypage' will contai header/footer/etc.. ad 1 line containing '$mylistbits'
eval('print_output("' . fetch_template('mypage') . '");');

Zelda-King
02-21-2006, 02:49 PM
Sorted! Thanks a lot for that example. I had a major breakthrough in how that all works together looking at that.