PHP Manual
PEAR Manual
Smarty Manual
PostgreSQL
MySQL Manual
Perl Manual
Ciekawe adresy
- Prezenty świąteczne
- Drzwi przesuwne
- Badania marketingowe
- Tłumaczenia Online
- Agencja Interaktywna
- Opony
- Salon Toyoty Poznań
- Nawierzchnie Kolejowe
- Strony Internetowe Poznań
Czytnik RSS
» Czwartkowy Przegląd PrasyTP interesuje się kupnem Aster... Google tworzy projekt konkurencyjny dla Facebooka... Zysk TPSA powyżej konsensusu... IBM otwiera centrum cloud computing na Politechnice Wrocławskiej... Jedna trzecia MŚP nie korzysta z usług IT... Polskie firmy chcą być częścią nadchodzącej rewolucji w rozrywce... Motorola kpi z najnowszego iPhona... Nawet Disney jest zainteresowany grami społecznościowymi...
» Sygnity: kontrakt na utrzymanie Pomostu za 14 mln zł
Ministerstwo Pracy i Polityki Społecznej zawarło z Sygnity umowę na utrzymanie oprogramowania użytkowego Pomost. Przez okres dwóch lat spółka zapewni rozwój i serwis oprogramowania wraz z usługami wsparcia dla użytkowników końcowych. Wartość umowy wynosi ponad 14 mln zł brutto.
» Internauci wolą surfowanie po sieci od seksu
O zgrozo. Jak wynika z sondażu PBI, internauci w wolnym czasie najchętniej wybierają surfowanie po sieci (90 proc.). Seks wskazała nieco ponad jedna czwarta ankietowanych.
» Uniwersytet Missouri: małe baterie atomowe
Baterie nuklearne, wytwarzające energię z rozkładu radioizotopów są atrakcyjną propozycją do wielu zastosowań, ponieważ izotopy, które je zasilają mogą dostarczać użytecznej ilości prądu przez setki lat przy gęstościach elektrycznych milion razy wyższych niż w standardowych bateriach. Baterie atomowe służyły wojsku i służbom powietrznym przez wiele lat, jednak ich duża wielkość ograniczała powszechne użytkowanie.
{foreach},{foreachelse}
{foreach} loops are an alternative to {section} loops. {foreach} is used to loop over a single associative array. the syntax for {foreach} is much easier than {section}, but as a tradeoff it can only be used for a single array. {foreach} tags must be paired with {/foreach} tags. required parameters are from and item. the name of the {foreach} loop can be anything you like, made up of letters, numbers and underscores. {foreach} loops can be nested, and the nested {foreach} names must be unique from each other. the from variable (usually an array of values) determines the number of times {foreach} will loop. {foreachelse} is executed when there are no values in the from variable.
| attribute name | type | required | default | description |
|---|---|---|---|---|
| from | array | yes | n/a | the array you are looping through |
| item | string | yes | n/a | the name of the variable that is the current element |
| key | string | no | n/a | the name of the variable that is the current key |
| name | string | no | n/a | the name of the foreach loop for accessing foreach properties |
example 7-6. {foreach} - item and key
the above example will output:
|
example 7-7. {foreach} - database example (eg pear or adodb)
|
{foreach} loops also have their own variables that handle {foreach} properties. these are indicated like so: {$smarty.foreach.foreachname.varname} with foreachname being the name specified as the name attribute of foreach
see {section} for examples of the properties below as they are identical
iteration
iteration is used to display the current loop iteration.iteration always starts with 1 and is incremented by one on each iteration.
show
show is used as a parameter to foreach. show is a boolean value, true or false. if false, the foreach will not be displayed. if there is a foreachelse present, that will be alternately displayed.
total
total is used to display the number of iterations that this foreach will loop. this can be used inside or after the foreach.
see also {section} and $smarty.foreach.
Najskuteczniejsza reklama to pozycjonowanie - Pozycjonowanie stron <= zajrzyj tu i dowiedz się więcej o pozycjonowanie stron