Smarty Forum Index Smarty
WARNING: All discussion is moving to https://reddit.com/r/smarty, please go there! This forum will be closing soon.

IF in foreach Funktioniert nicht richtig

 
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    Smarty Forum Index -> Language: German
View previous topic :: View next topic  
Author Message
befisch
Smarty n00b


Joined: 26 Oct 2004
Posts: 2

PostPosted: Tue Oct 26, 2004 11:32 am    Post subject: IF in foreach Funktioniert nicht richtig Reply with quote

Hallo, bin neu hier und gleich mal ein Problem Wink
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
View user's profile Send private message
messju
Administrator


Joined: 16 Apr 2003
Posts: 3336
Location: Oldenburg, Germany

PostPosted: Tue Oct 26, 2004 12:11 pm    Post subject: Reply with quote

was steht den in $datenb drin ?

{$datenb|@debug_print_var} bzw. im template oder die debugconsole liefert das.
Back to top
View user's profile Send private message Send e-mail Visit poster's website
befisch
Smarty n00b


Joined: 26 Oct 2004
Posts: 2

PostPosted: Tue Oct 26, 2004 1:52 pm    Post subject: Reply with quote

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
View user's profile Send private message
Display posts from previous:   
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    Smarty Forum Index -> Language: German All times are GMT
Page 1 of 1

 
Jump to:  
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
Protected by Anti-Spam ACP