|
Smarty
WARNING: All discussion is moving to https://reddit.com/r/smarty, please go there! This forum will be closing soon. |
|
View previous topic :: View next topic |
Author |
Message |
befisch Smarty n00b
Joined: 26 Oct 2004 Posts: 2
|
Posted: Tue Oct 26, 2004 11:32 am Post subject: IF in foreach Funktioniert nicht richtig |
|
|
Hallo, bin neu hier und gleich mal ein Problem
Also:
PHP COde:
Code: |
$showbg = datendetail($gyn_baby, $bid);
$smarty->assign('datenb', $showbg);
$tpl="baby/show-babydetail.tpl";
$smarty->assign('content',$tpl);
|
Smarty
Code: |
{foreach from=$datenb item=daten name="detail"}
<table border="1">
<tr>
<td><img src="gyn/baby/aktuell/{$daten.bildeins}_normal.jpg" width="300" /></td>
</tr>
<tr>
<td>
<table border="1">
{if $daten.kindname ne ""}
<tr>
<td>Name</td>
<td>{$daten.kindname}</td>
</tr>
{/if}
<tr>
<td>Geburtsdatum:</td>
<td>{$daten.gebdatum}</td>
</tr>
<tr>
<td>Geburtszeit:</td>
<td>{$daten.gebzeit}</td>
</tr>
<tr>
<td>Gewicht:</td>
<td>{$daten.gebgewicht}</td>
</tr>
<tr>
<td>Größe:</td>
<td>{$daten.gebgroesse}</td>
</tr>
</table>
</td>
</tr>
</table>
{/foreach}
Also irgenwie kennt er die Variable $daten.xxx nicht, wenn ich sie aus {if} raus benutze.
Ich hiermit erreichen dass die jeweilige <tr> nur ausgegeben wird, wenn diese auch gesetzt ist.
Wiekann man das machen?
Danke für euere hilfe |
|
|
Back to top |
|
messju Administrator
Joined: 16 Apr 2003 Posts: 3336 Location: Oldenburg, Germany
|
Posted: Tue Oct 26, 2004 12:11 pm Post subject: |
|
|
was steht den in $datenb drin ?
{$datenb|@debug_print_var} bzw. im template oder die debugconsole liefert das. |
|
Back to top |
|
befisch Smarty n00b
Joined: 26 Oct 2004 Posts: 2
|
Posted: Tue Oct 26, 2004 1:52 pm Post subject: |
|
|
Danke für den Tipp mit dem debug.
Hab inzwischen einfach mal den ganzen Code neu geschrieben, und jetzt funktionierts!!?
Hatte wohl irgendwo ein è é oder so drinne..
Danke für deine Hilfe |
|
Back to top |
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|