"mvt:foreach" Snippets


View "miva_array_delete() within mvt:foreach"
<h1>miva_array_delete() within mvt:foreach</h1> <mvt:assign name="l.settings:example:list[1]" value="'Bananas'" /> <mvt:assign name="l.settings:example:list[2]" value="'Milk'" /> <mvt:assign name="l.settings:example:list[3]" value="'Bread'" /> <mvt:assign name="l.settings:example:list[4]" value="'Cereal'" /> <h4>Before:</h4> <mvt:eval expr="decodeattribute(glosub(miva_array_serialize(l.settings:example), ',', '<br>'))" /> <mvt:foreach iterator="item" array="example:list"> <mvt:if expr="l.settings:item EQ 'Milk'"> <mvt:assign name="l.result" value="miva_array_delete( l.settings:example:list, l.POS1, 1 )" /> </mvt:if> </mvt:foreach> <h4>After:</h4> <mvt:eval expr="decodeattribute(glosub(miva_array_serialize(l.settings:example), ',', '<br>'))" />
 

Basket #36954

Created: 1490113529
View "Basket #36954"
<mvt:assign name="l.settings:days[1]" value="'Sunday'" /> <mvt:assign name="l.settings:days[2]" value="'Monday'" /> <mvt:assign name="l.settings:days[3]" value="'Tuesday'" /> <mvt:assign name="l.settings:days[4]" value="'Wednesday'" /> <mvt:assign name="l.settings:days[5]" value="'Thursday'" /> <mvt:assign name="l.settings:days[6]" value="'Friday'" /> <mvt:assign name="l.settings:days[7]" value="'Saturday'" /> <mvt:assign name="l.settings:meals[1]" value="'Breakfast'" /> <mvt:assign name="l.settings:meals[2]" value="'Lunch'" /> <mvt:assign name="l.settings:meals[3]" value="'Dinner'" /> <ul> <mvt:foreach iterator="day" array="days"> <li> <h2>&mvt:day;</h2> <div> l.pos1=<mvt:eval expr="g.pos1" /><br> l.count1=<mvt:eval expr="g.count1" /> </div> <ul> <mvt:foreach iterator="meal" array="meals"> <li> <h4>&mvt:meal;</h4> <div> l.pos2=<mvt:eval expr="l.pos2" /><br> l.count2=<mvt:eval expr="l.count2" /> </div> </li> </mvt:foreach> </ul> </li> </mvt:foreach> </ul>
 
View "mvt:foreach has l.posN & l.countN"
<mvt:assign name="l.settings:days[1]" value="'Sunday'" /> <mvt:assign name="l.settings:days[2]" value="'Monday'" /> <mvt:assign name="l.settings:days[3]" value="'Tuesday'" /> <mvt:assign name="l.settings:days[4]" value="'Wednesday'" /> <mvt:assign name="l.settings:days[5]" value="'Thursday'" /> <mvt:assign name="l.settings:days[6]" value="'Friday'" /> <mvt:assign name="l.settings:days[7]" value="'Saturday'" /> <mvt:assign name="l.settings:meals[1]" value="'Breakfast'" /> <mvt:assign name="l.settings:meals[2]" value="'Lunch'" /> <mvt:assign name="l.settings:meals[3]" value="'Dinner'" /> <ul> <mvt:foreach iterator="day" array="days"> <li> <h2>&mvt:day;</h2> <div> l.pos1=<mvt:eval expr="l.pos1" /><br> l.count1=<mvt:eval expr="l.count1" /> </div> <ul> <mvt:foreach iterator="meal" array="meals"> <li> <h4>&mvt:meal;</h4> <div> l.pos2=<mvt:eval expr="l.pos2" /><br> l.count2=<mvt:eval expr="l.count2" /> </div> </li> </mvt:foreach> </ul> </li> </mvt:foreach> </ul>
 
View "mvt:foreach has l.pos1 & l.count"
<mvt:assign name="l.settings:days[1]" value="'Sunday'" /> <mvt:assign name="l.settings:days[2]" value="'Monday'" /> <mvt:assign name="l.settings:days[3]" value="'Tuesday'" /> <mvt:assign name="l.settings:days[4]" value="'Wednesday'" /> <mvt:assign name="l.settings:days[5]" value="'Thursday'" /> <mvt:assign name="l.settings:days[6]" value="'Friday'" /> <mvt:assign name="l.settings:days[7]" value="'Saturday'" /> <mvt:assign name="l.settings:meals[1]" value="'Breakfast'" /> <mvt:assign name="l.settings:meals[2]" value="'Lunch'" /> <mvt:assign name="l.settings:meals[3]" value="'Dinner'" /> <ul> <mvt:foreach iterator="day" array="days"> <li> <h2>&mvt:day;</h2> <div> l.pos1=<mvt:eval expr="l.pos1" /><br> l.count1=<mvt:eval expr="l.count1" /> </div> <ul> <mvt:foreach iterator="meal" array="meals"> <li> <h4>&mvt:meal;</h4> <div> l.pos2=<mvt:eval expr="l.pos2" /><br> l.count2=<mvt:eval expr="l.count2" /> </div> </li> </mvt:foreach> </ul> </li> </mvt:foreach> </ul>
 
View "mvt:foreach has l.pos1 & l.count"
<mvt:assign name="l.settings:days[1]" value="'Sunday'" /> <mvt:assign name="l.settings:days[2]" value="'Monday'" /> <mvt:assign name="l.settings:days[3]" value="'Tuesday'" /> <mvt:assign name="l.settings:days[4]" value="'Wednesday'" /> <mvt:assign name="l.settings:days[5]" value="'Thursday'" /> <mvt:assign name="l.settings:days[6]" value="'Friday'" /> <mvt:assign name="l.settings:days[7]" value="'Saturday'" /> <mvt:assign name="l.settings:meals[1]" value="'Breakfast'" /> <mvt:assign name="l.settings:meals[2]" value="'Lunch'" /> <mvt:assign name="l.settings:meals[3]" value="'Dinner'" /> <ul> <mvt:foreach iterator="day" array="days"> <li> <h2>&mvt:day;</h2> <p> l.pos1=<mvt:eval expr="l.pos1" /><br> l.count1=<mvt:eval expr="l.count1" /><br> </p> <ul> <mvt:foreach iterator="meal" array="meals"> <li> <h4>&mvt:meal;</h4> <p> l.pos2=<mvt:eval expr="l.pos2" /><br> l.count2=<mvt:eval expr="l.count2" /><br> </p> </li> </mvt:foreach> </ul> </li> </mvt:foreach> </ul>