Smarty Forum Index Smarty
The discussions here are for Smarty, a template engine for the PHP programming language.
Katalogvorlage mit Smarty? foreach

 
Post new topic   Reply to topic    Smarty Forum Index -> Language: German
View previous topic :: View next topic  
Author Message
Trax3r
Smarty n00b


Joined: 03 Mar 2014
Posts: 3

PostPosted: Mon Mar 03, 2014 9:23 am    Post subject: Katalogvorlage mit Smarty? foreach Reply with quote

Hallo!

Ich versuche gerade ein Katalog mit PHP über Smarty zu erzeugen.
Scheitere allerdings an ein paar ecken.

Ich schaffe es im blauen Bereich meine Produktliste auszugeben,
ca. 2000 produkte, allerdings schaffe ich es nicht, nach erreichen der Festenhöhe oder Anzahl so eine art break zu schalten das er eine neue Seite nimmt und da weiter füllt.

Vereinfachter Code:
Code:

<div class="page">
     <div class="header"></div>
     <div class="Produktliste">
          <table id="katalog" class="size18-6">
            <tr>
                <td>Name</td>
                <td>info1</td>
                <td>info2</td>
                <td>Baujahr</td>
                <td>Artikelnr</td>
                <td>F</td>
                <td>Kg</td>
                <td>Preis</td>
                <td>Artikelnr</td>
                <td>F</td>
                <td>Kg</td>
                <td>Preis</td>
            </tr>
            {foreach from=$rows item=row}
            <tr class="zeile{cycle values=', grey'}">
                <td>{$row.Modell}</td>
                <td>{$row.Info1}</td>
                <td>{$row.Info2}</td>
                <td>{$row.Baujahr}</td>
                <td class="border-left">{$row.ArtikelNr}</td>
                <td>{$row.MaxFahrrad}</td>
                <td>{$row.MaxNutzlast}</td>
                <td>{$row.Preis}</td>
                {if $row.Tieflader}
                <td class="border-left">{if !$row.ArtikelNr|strstr:"+45"}{$row.ArtikelNr}+{/if}{$row.Tieflader}</td>
                <td>2</td>
                <td>{$row.MaxNutzlast2}</td>
                <td>{$row.Preis2}</td>
                {else}
                <td colspan="4"></td>
                {/if}
            </tr>
            {/foreach}
        </table>
     </div>
     <div class="Side"></div>
     <div class="footer"></div>
</div>


Ich hoffe Ihr könnt mir helfen

Mit freundlichen Grüßen

Francois
Back to top
View user's profile Send private message
U.Tews
Administrator


Joined: 22 Nov 2006
Posts: 4596
Location: Hamburg / Germany

PostPosted: Tue Mar 04, 2014 3:43 pm    Post subject: Reply with quote

Siehe http://www.smarty.net/docs/en/language.function.foreach.tpl

Example 7.35
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    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