Seite 1 von 1

datenbank auslesen ?

Verfasst: 07.10.2004 16:35
von Tecwar
hi,

ich versuche ein teil aus einer datenbank aus zu lesen.
den inhalt möchte ich als liste aus geben.
bekomme aber keine ausgabe des inhalts zu stande.
kann mir jemand sagen wo der fehler liegt ?

php-datei:

Code: Alles auswählen

<?php
define('IN_PHPBB', true);
$phpbb_root_path = './';
include($phpbb_root_path . 'extension.inc');
include($phpbb_root_path . 'common.'.$phpEx);
$userdata = session_pagestart($user_ip, PAGE_INDEX);
init_userprefs($userdata);
define('SHOW_ONLINE', true);
$page_title = "test";
include($phpbb_root_path . 'includes/page_header.'.$phpEx);
//
$template->set_filenames(array(
	'body' => 'test_body.tpl')
);
$sql = "SELECT template_name 
			FROM " . THEMES_TABLE . "
			ORDER BY template_name";
		if(!$result = $db->sql_query($sql))
		{
			message_die(GENERAL_ERROR, "keine information!", "", __LINE__, __FILE__, $sql);
		}
$style_rowset = $db->sql_fetchrowset($result);
$template->set_filenames(array(
			"body" => "test_body.tpl")
		);
$template->assign_vars(array(
			"L_TEMPLATE" => $lang['Template']
			)
		);
for($i = 0; $i < count($style_rowset); $i++)
		{
			$template->assign_blo
ck_vars("styles", array(
				"TEMPLATE_NAME" => $style_rowset[$i]['template_name']));
		}

		if (empty($HTTP_POST_VARS['send_file']));
		$template->pparse("body");
{ 
include($phpbb_root_path . 'includes/page_tail.'.$phpEx);
}
?>
tpl-datei:

Code: Alles auswählen

<br /><br />
<table width="100%" cellpadding="2" cellspacing="1" border="0" class="forumline" height="150">
  <tr> 
	<th class="thSides" height="25" nowrap="nowrap">test_body</th>
  </tr>
  <!-- BEGIN newsrow -->
  <tr> 
  <td class="row1">
  <tr> 
	  <td class="row1"><span class="gen">{template_name}{Template}</span></td>
	</tr>
  <br />
  <div align="right" class="genmed">&nbsp;</div>
  </td>
  </tr>
  <!-- END newsrow -->
  <tr> 
  <td class="row1" align="center">
  <div class="genmed">
  &nbsp;</div>
  </td>
  </tr>
</table>

Verfasst: 07.10.2004 18:15
von Leuchte

Code: Alles auswählen

<?php 
define('IN_PHPBB', true); 
$phpbb_root_path = './'; 
include($phpbb_root_path . 'extension.inc'); 
include($phpbb_root_path . 'common.'.$phpEx); 
$userdata = session_pagestart($user_ip, PAGE_INDEX); 
init_userprefs($userdata); 
define('SHOW_ONLINE', true); 
$page_title = "test"; 
include($phpbb_root_path . 'includes/page_header.'.$phpEx); 
// 
$template->set_filenames(array( 
   'body' => 'test_body.tpl') 
); 
      $sql = "SELECT template_name 
        FROM " . THEMES_TABLE . " 
        ORDER BY template_name"; 
      if(!$result = $db->sql_query($sql)) 
      { 
        message_die(GENERAL_ERROR, "keine information!", "", __LINE__, __FILE__, $sql); 
      } 
      $style_rowset = array();
      while ( $row = $db->sql_fetchrow($result) )
      {
       $style_rowset[] = $row;
      } 
       
      $template->assign_vars(array( 
         "L_TEMPLATE" => $lang['Template']) 
      ); 
      
      for($i = 0; $i < count($style_rowset); $i++) 
      { 
        $template->assign_block_vars("styles", array( 
            "TEMPLATE_NAME" => $style_rowset[$i]['template_name'])
        ); 
      } 

$template->pparse("body"); 
 
include($phpbb_root_path . 'includes/page_tail.'.$phpEx); 
 
?>

Code: Alles auswählen

<br /><br /> 
<table width="100%" cellpadding="2" cellspacing="1" border="0" class="forumline" height="150"> 
  <tr> 
   <th class="thSides" height="25" nowrap="nowrap">test_body</th> 
  </tr> 
  <!-- BEGIN styles --> 
  <tr> 
  <td class="row1"> 
  <tr> 
     <td class="row1"><span class="gen">{styles.TEMPLATE_NAME}{L_TEMPLATE}</span></td> 
   </tr> 
  <br /> 
  <div align="right" class="genmed">&nbsp;</div> 
  </td> 
  </tr> 
  <!-- END styles --> 
  <tr> 
  <td class="row1" align="center"> 
  <div class="genmed"> 
  &nbsp;</div> 
  </td> 
  </tr> 
</table>

Verfasst: 08.10.2004 16:04
von Tecwar
hi,
Danke

Verfasst: 08.10.2004 17:33
von Tecwar
hab noch mal etwas damit gebastelt.
hab da raus styles changer gemacht

Demo


Danke Leuchte (aber auch wenn ich wieder hohle)

ps: falls das jemand haben möchte

Download