PRobleme im Umgang mit Template Klasse
Verfasst: 29.09.2003 22:29
Er gibt das Template xw_body korrekt ohne jegliche Fehlermeldung aus. Auch der "Block" wird der while entsprechend wiederholt jedoch ersetzt er die Platzhalter nicht sprich die Funktion assign_block_vars geht nicht so wie ich will. Wo liegt mein Fehler, was mach ich falsch? 
Code:
Template:

Code:
Code: Alles auswählen
<?
define('IN_PHPBB', true);
include($phpbb_root_path . 'extension.inc');
include($phpbb_root_path . 'common.'.$phpEx);
$userdata = session_pagestart($user_ip, PAGE_INDEX);
init_userprefs($userdata);
include($phpbb_root_path . 'includes/page_header.'.$phpEx);
$template->set_filenames(array(
'xw_body' => 'xw_body.tpl')
);
if (xw_access($userdata["user_id"])) {
$result = mysql_query("SELECT id FROM phpbb_xw_spieler WHERE name='$spieler'");
$spieler = mysql_fetch_array($result);
if ($spieler) {
$result = mysql_query("SELECT * FROM phpbb_xw_planeten WHERE besitzer='$spieler[id]'");
while ($planeten = mysql_fetch_array($result)){
$template->assign_block_vars('planrow', array(
'XW_GAL' => $planeten[galaxie],
'XW_SYS' => $planeten[system],
'XW_PLAN' => $planeten[planet],
'XW_SPIELER' => $spieler[name])
);
}
}
}
else { message_die(GENERAL_MESSAGE, "Nichts für dich"); }
$template->pparse('xw_body');
include($phpbb_root_path . 'includes/page_tail.'.$phpEx);
?>
Code: Alles auswählen
<table width="100%" cellpadding="2" cellspacing="1" border="0" class="forumline">
<tr>
<th class="thCornerL" height="25" nowrap="nowrap"> Gal </th>
<th class="thTop" nowrap="nowrap"> Sys </th>
<th class="thTop" nowrap="nowrap"> Plan </th>
<th colspan="2" class="thCornerR" nowrap="nowrap"> </th>
</tr>
<!-- BEGIN planrow -->
<tr>
<td class="row2" align="center" valign="middle" width="20" height="25"><span class="gensmall">{XW_GAL}</span></td>
<td class="row2" align="center" valign="middle" width="20" nowrap="nowrap"> <span class="gensmall">{XW_SYS}</span></td>
<td class="row2" align="center" valign="middle" width="20"><span class="gensmall">{XW_PLAN}</span></td>
<td class="row1"><span class="forumlink"> <a href="viewxwdb.php?spieler={XW_SPIELER}" class="forumlink">{XW_SPIELER}</a> </span></td>
</tr>
<!-- END planrow -->
</table>