Seite 1 von 1

phpbb_fetch_all Problem mit polls.php-Einbindung

Verfasst: 26.07.2005 17:49
von EnzephaloN
Hallo Leute. Kleines Problem bestimmt nur, aber ich komm nich weiter.

Code: Alles auswählen

<?
define ('IN_PHPBB', true);
$phpbb_root_path = '../forum/';
if (!file_exists($phpbb_root_path . 'extension.inc'))
{
    die ('<tt><b>phpBB Fetch All:</b>
          $phpbb_root_path is wrong and does not point to your forum.</tt>');
}
include_once ('extension.inc');
include_once ('common.' . $phpEx);
include_once ($phpbb_root_path . 'mods/phpbb_fetch_all/common.' . $phpEx);
$userdata = session_pagestart($user_ip, PAGE_INDEX);
init_userprefs($userdata);

include('mods/phpbb_fetch_all/polls.php');
$poll = phpbb_fetch_poll_bt(1);                                       
                                                                      
     if ($poll)                                                       
     {                                                                
         echo $poll['vote_text'];                                     
         echo '<form method="post" action="' . $phpbb_root_path;      
         echo 'posting.php?t=' . $poll['topic_id'] . '">';            
         for ($i = 0; $i < count($poll['options']); $i++)             
         {                                                            
             echo '<input type="radio" name="vote_id" value="';       
             echo $poll['options'][$i]['vote_option_id'] . '">';      
             echo $poll['options'][$i]['vote_option_text'];           
             echo '<br>';                                             
         }                                                            
         echo '<input type="hidden" name="topic_id" value="';         
         echo $poll['topic_id'] . '">';                               
         echo '<input type="hidden" name="mode" value="vote">';       
         echo '<input type="submit" name="submit" value="Vote">';     
     }                                                           
phpbb_disconnect();     
?>
Dabei erscheint dann nur als Ausgabe:

Code: Alles auswählen

Warning: Cannot modify header information - headers already sent by (output started at /mnt/blaaa/htdocs/neu/overall_header.php:12) in /mnt/blaaa/htdocs/forum/includes/sessions.php on line 200

Warning: Cannot modify header information - headers already sent by (output started at /mnt/blaaa/htdocs/neu/overall_header.php:12) in /mnt/blaaa/htdocs/forum/includes/sessions.php on line 201
Bitte um Unterstützung!

EnzephaloN

Verfasst: 27.07.2005 19:55
von EnzephaloN
sorry, aber ich schieb ihn nochmal nach oben ;-)

Kann ich irgendwie durch ein DEFINE ausschließen, daß die header nochmals gesendet werden?

Noch genauer zum Problem: Die unten angegebene poll_on_index.php wird per include in meine index.php eingebunden. overall_header.php wird dort includiert.

Es macht doch auch keinen Unterschied, ob ich eine Datei includiere oder ob ich den Code direkt in die Datei schreibe, oder?

EnzephaloN

Verfasst: 28.07.2005 00:29
von EnzephaloN
Ok, das eine Problem ist behoben! Keine Ahnung wie, aber plötzlich ging es.

Leider habe ich nun ein neues Problem, worüber ich nun Stunden schon brüte. Erstmal der komplette Code:

Code: Alles auswählen

<?
define ('IN_PHPBB', true);
define('HEADER_INC', false);
$phpbb_root_path = '../forum/';
if (!file_exists($phpbb_root_path . 'extension.inc'))
{
    die ('<tt><b>phpBB Fetch All:</b>
          $phpbb_root_path is wrong and does not point to your forum.</tt>');
}
include_once ('extension.inc');
include_once ('common.' . $phpEx);
include_once ($phpbb_root_path . 'mods/phpbb_fetch_all/common.' . $phpEx);
$userdata = session_pagestart($user_ip, PAGE_INDEX);
init_userprefs($userdata);

include('mods/phpbb_fetch_all/polls.php');
$poll = phpbb_fetch_poll_bt(56);                                       
   if ($poll)                                                       
   {
     if (!$user_voted || !$view_result || !$poll_expired || $is_auth['auth_vote'] || $forum_topic_data['topic_status'] != TOPIC_LOCKED )
     {                                                                
         echo $poll['vote_text'];                                     
         echo '<form method="post" action="' . $phpbb_root_path;      
         echo 'posting.php?t=' . $poll['topic_id'] . '">';            
         for ($i = 0; $i < count($poll['options']); $i++)             
         {                                                            
             echo '<input type="radio" name="vote_id" value="';       
             echo $poll['options'][$i]['vote_option_id'] . '">';      
             echo $poll['options'][$i]['vote_option_text'];           
             echo '<br>';                                             
         }                                                              
     } 
     else
     {
         echo'<table cellspacing="0" cellpadding="2" border="0">
		 	<tr> 
		 	  <td><span class="gen">'.$poll['vote_text'].'</span></td>
		 	  <td> 
		 		<table cellspacing="0" cellpadding="0" border="0">';
         $vote_results_sum = 0;

			for($i = 0; $i < $vote_options; $i++)
			{
				$vote_results_sum += $vote_info[$i]['vote_result'];
			}

			$vote_graphic = 0;
			$vote_graphic_max = count($images['voting_graphic']);
			  
         for($i = 0; $i < $vote_options; $i++)
		{
				$vote_percent = ( $vote_results_sum > 0 ) ? $vote_info[$i]['vote_result'] / $vote_results_sum : 0;
				$vote_graphic_length = round($vote_percent * $board_config['vote_graphic_length']);

				$vote_graphic_img = $images['voting_graphic'][$vote_graphic];
				$vote_graphic = ($vote_graphic < $vote_graphic_max - 1) ? $vote_graphic + 1 : 0;

				if ( count($orig_word) )
				{
					$vote_info[$i]['vote_option_text'] = preg_replace($orig_word, $replacement_word, $vote_info[$i]['vote_option_text']);
				}
				$vote_percent_self = sprintf("%.1d%%", ($vote_percent * 100));
			echo' <tr>
			        <td colspan="4">'.$vote_info[$i]['vote_option_text'].'</td>
			      </tr>
				  <tr> 
					<td><img src="' . $phpbb_root_path . 'templates/AdInfinitum/images/vote_lcap.gif" width="4" alt="" height="12" ></td>
					<td><img src="' . $phpbb_root_path . 'templates/AdInfinitum/images/voting_bar.gif" width="' . $vote_graphic_length . ' " height="12" alt="'. $vote_percent.'" ></td>
    				<td><img src="' . $phpbb_root_path . 'templates/AdInfinitum/images/vote_rcap.gif" width="4" alt="" height="12" ></td>
    				<td>'.$vote_percent_self.'</td>
				  </tr>';
		 }
			echo'</table>
			  </td>
			</tr>
		  </table>';
    }              

if ($userdata['session_logged_in']) {
   echo'<input type="submit" class="mainoption" name="submit" value="'.$lang['Submit_vote'].'">';
   echo'<input type="hidden" name="topic_id" value="'. $poll['topic_id'].'">';
   echo'<input type="hidden" name="mode" value="vote">';
}
else { 
   echo'<span class="gensmall">'.$lang['Rules_vote_cannot'].'</span>';
}
phpbb_disconnect();  
echo '<table width="100%">
       <tr>
         <td align="center" class="textnormalohnerahmen">
             Nur im Forum registrierte und angemeldete User k&ouml;nnen abstimmen
         </td>
       </tr>
      </table>';
 ?>
Fehler nun: ein unexpected $ in der letzten zeile. Kappier ich überhaupt nicht, da da doch nur ?> steht...

Bitte um Hilfe!

EnzephaloN