Seite 1 von 1

Letzte Umfrage auf dem Index anzeigen

Verfasst: 12.04.2004 19:34
von kratzer54847
hoi,ich bastele gerade eine Anzeige auf dem Forenindex für die letzte Umfrage.

in der functions.php habe ich diese Funktion eingefügt

Code: Alles auswählen

function phpbb_fetch_poll($forum_sql)
{
	global $db;

	$sql = 'SELECT
			  t.*,
			  vd.*
			FROM
			  ' . TOPICS_TABLE	 . ' AS t,
			  ' . VOTE_DESC_TABLE  . ' AS vd
			WHERE
			  t.forum_id IN (' . $forum_sql . ') AND
			  t.topic_status <> 1 AND
			  t.topic_status <> 2 AND
			  t.topic_vote = 1 AND
			  t.topic_id = vd.topic_id
			ORDER BY
			  t.topic_time DESC
			LIMIT
			  0,1';

	if (!$query = $db->sql_query($sql))
	{
		message_die(GENERAL_ERROR, 'Could not query poll information', '', __LINE__, __FILE__, $sql);
	}

	$result = $db->sql_fetchrow($query);

	if ($result)
	{
		$sql = 'SELECT
				  *
				FROM
				  ' . VOTE_RESULTS_TABLE . '
				WHERE
				  vote_id = ' . $result['vote_id'] . '
				ORDER BY
				  vote_option_id';

		if (!$query = $db->sql_query($sql))
		{
			message_die(GENERAL_ERROR, 'Could not query vote result information', '', __LINE__, __FILE__, $sql);
		}

		while ($row = $db->sql_fetchrow($query))
		{
			$result['options'][] = $row;
		}		
	}

	return $result;
}
hier wird die letzte Umfrage ermittelt...doch auf dem Index bekomme ich nur den Titel zu sehen,nicht aber die Umfrageoptionen.

in der Index.php habe ich das eingefügt

Code: Alles auswählen

//
// Configuration for Poll
//
$CFG['poll_forum'] = '1'; // Enter Poll Forum ID

$fetchpoll = phpbb_fetch_poll($CFG['poll_forum']);

// Post Fetch
function phpbb_fetch_posts($forum_sql, $number_of_posts, $text_length)
{
	global $db, $board_config;

	$sql = 'SELECT
			  t.topic_id,
			  t.topic_time,
			  t.topic_title,
			  pt.post_text,
			  u.username,
			  u.user_id,
			  t.topic_replies,
			  pt.bbcode_uid,
			  t.forum_id,
			  t.topic_poster,
			  t.topic_first_post_id,
			  t.topic_status,
			  pt.post_id,
			  p.post_id,
			  p.enable_smilies
			FROM
			  ' . TOPICS_TABLE . ' AS t,
			  ' . USERS_TABLE . ' AS u,
			  ' . POSTS_TEXT_TABLE . ' AS pt,
			  ' . POSTS_TABLE . ' AS p
			WHERE
			  t.forum_id IN (' . $forum_sql . ') AND
			  t.topic_time <= ' . time() . ' AND
			  t.topic_poster = u.user_id AND
			  t.topic_first_post_id = pt.post_id AND
			  t.topic_first_post_id = p.post_id AND
			  t.topic_status <> 2
			ORDER BY
			  t.topic_time DESC';
	if ($number_of_posts != 0)
	{
		$sql .= '
			LIMIT
			  0,' . $number_of_posts;
	}
}


//  Poll Output


if (!empty($fetchpoll))
{
	$template->assign_vars(array(		
		'S_POLL_QUESTION' => $fetchpoll['vote_text'],
		'S_POLL_ACTION' => append_sid('posting.'.$phpEx.'?'.POST_TOPIC_URL.'='.$fetchpoll['topic_id']),
		'S_TOPIC_ID' => $fetchpoll['topic_id'],
		'L_SUBMIT_VOTE' => $lang['Submit_vote'],
		'L_LOGIN_TO_VOTE' => $lang['Login_to_vote']		
		)
	);

	for ($i = 0; $i < count($fetchpoll['options']); $i++)
	{
		$template->assign_block_vars('poll_option_row', array(
			'OPTION_ID' => $fetchpoll['options'][$i]['vote_option_id'],
			'OPTION_TEXT' => $fetchpoll['options'][$i]['vote_option_text'],
			'VOTE_RESULT' => $fetchpoll['options'][$i]['vote_result'],
			)
		);
	}	
}
else
{
	$template->assign_vars(array(		
		'S_POLL_QUESTION' => $lang['No_poll'],
		'DISABLED' => 'disabled="disabled"'
		)
	);
}
Auf dem Index wird zwar der Titel der neusten Umfrage angezeigt,aber nicht die Optionen.

Code: Alles auswählen

<!-- BEGINN UMFRAGE AUF DEM INDEX -->
<table width="100%" cellpadding="1" cellspacing="1" border="0" class="forumline">
<tr><td class="catHead" height="28"><span class="cattitle">{L_POLL}</span></td></tr>
<tr><td class="row1" align="left">
	<form method="post" action="{S_POLL_ACTION}">
	<center><span class="gensmall"><b>{S_POLL_QUESTION}</b></span></center>
	<!-- BEGIN poll_option_row -->
	<input type="radio" name="vote_id" value="{poll_option_row.OPTION_ID}">{poll_option_row.OPTION_TEXT}&nbsp;[{poll_option_row.VOTE_RESULT}]<br />
	<!-- END poll_option_row -->
	<br />
	<center><input type="submit" class="mainoption" name="submit" value="{L_VOTE_BUTTON}" {DISABLED}></center>
	<input type="hidden" name="topic_id" value="{S_TOPIC_ID}">
	<input type="hidden" name="mode" value="vote">
	</form>
	</span></td></tr>
</table>
<!-- ENDE UMFRAGE AUF DEM INDEX -->
der Titel der Umfrage wird zwar angezeigt,nicht aber die Optionen
kann mir jemand weiterhelfen?

Verfasst: 13.04.2004 23:18
von kratzer54847
niemand eine Idee?

Verfasst: 20.12.2005 13:24
von kleinermuuk
wäre an sowas auch SEHR interessiert!!!!