par
YADev » 07 août 2012, 15:38
Il y a un titre de sondage, un membre, et possibilité de plusieurs choix pour chaque membre.
Je travail sous phpBB, donc c'est comme ici.
$tab = array();
while ($row = $db->sql_fetchrow($result))
{
$user_colour = ($row['user_colour']) ? ' style="color:#' . $row['user_colour'] . '" class="username-coloured"' : '';
$username_full = ($row['user_type'] != USER_IGNORE) ? get_username_string('full', $row['user_id'], $row['username'],
$row['user_colour']) . ', ' : '<span' . $user_colour . '>' . $row['username'] . '</span>, ';
// Vars templates.
$template->assign_block_vars('user_row', array(
'WHO_VOTED' => substr($username_full, 0, -2),
'TITLE_POLL' => $row['poll_title'],
// 'LIST_VOTES' => rtrim($row['poll_option_text'], ', ')
));
// Var for displaying votes.
$author = substr($username_full, 0, -2);
$title = $row['poll_title'];
$poll_text = $row['poll_option_text'];
$tab[$author][$title][] = $poll_text;
}
// Display choices.
foreach ($tab as $author => $choix)
{
$template->assign_block_vars('user_row', array(
'LIST_VOTES' => implode($choix,', ');
));
}
Mais ce n'est pas bon, rien ne s'affiche ...
C'est bien formaté pourtant non ?
Il y a un titre de sondage, un membre, et possibilité de plusieurs choix pour chaque membre.
Je travail sous phpBB, donc c'est comme ici.
[php]$tab = array();
while ($row = $db->sql_fetchrow($result))
{
$user_colour = ($row['user_colour']) ? ' style="color:#' . $row['user_colour'] . '" class="username-coloured"' : '';
$username_full = ($row['user_type'] != USER_IGNORE) ? get_username_string('full', $row['user_id'], $row['username'],
$row['user_colour']) . ', ' : '<span' . $user_colour . '>' . $row['username'] . '</span>, ';
// Vars templates.
$template->assign_block_vars('user_row', array(
'WHO_VOTED' => substr($username_full, 0, -2),
'TITLE_POLL' => $row['poll_title'],
// 'LIST_VOTES' => rtrim($row['poll_option_text'], ', ')
));
// Var for displaying votes.
$author = substr($username_full, 0, -2);
$title = $row['poll_title'];
$poll_text = $row['poll_option_text'];
$tab[$author][$title][] = $poll_text;
}
// Display choices.
foreach ($tab as $author => $choix)
{
$template->assign_block_vars('user_row', array(
'LIST_VOTES' => implode($choix,', ');
));
} [/php]
Mais ce n'est pas bon, rien ne s'affiche ... :cry:
C'est bien formaté pourtant non ?