"explode" Snippets


View "Basket #46802"
<mvt:assign name="l.settings:basket:items[1]:code" value="'doe'" /> <mvt:assign name="l.settings:basket:items[2]:code" value="'ray'" /> <mvt:assign name="l.settings:basket:items[3]:code" value="'mee'" /> <mvt:assign name="l.settings:basket:items[4]:code" value="'fah'" /> <mvt:assign name="l.settings:basket:items[5]:code" value="'soh'" /> <mvt:assign name="l.settings:basket:items[6]:code" value="'lah'" /> <mvt:assign name="l.settings:basket:items[7]:code" value="'tee'" /> <h2>Always at End</h2> <mvt:foreach iterator="item" array="basket:items"> "&mvt:item:code;", </mvt:foreach> <h2>Using POS1</h2> <mvt:foreach iterator="item" array="basket:items"> <mvt:if expr="POS1 EQ 2">,</mvt:if> "&mvt:item:code;" </mvt:foreach> <hr> &mvt:basket:items[4]:code;
 
View "Basket #32640"
<style> #email-popup{ max-width: 449px; min-height: 250px; text-align: center; background: green; padding: 1.5rem; } .popup-line-one{ font-size: 2rem; } .popup-line-two{ font-size: 1.2rem; text-transform: uppercase; } .popup-hr{ height: 1px; background: #000; max-width: 50px; margin: .5rem auto; } .popup-text{ font-size: 1rem; } #popup-form{ width: 100%; } #email-popup input{ border: 1px solid #DEDEDE; width: 100%; height: 42px; } </style> <div id="email-popup"> <div class="popup-line-one">15% Off</div> <div class="popup-line-two">Your first order</div> <div class="popup-hr"></div> <div class="popup-text">Be the first to know about our promotions, limited edition products and other rad stuff!</div> <br /> <form id="popup-form"> <input type="email" placeholder="Enter your email here" /> </form> </div>
 
View "Basket #31387"
<mvt:comment>JSON Data</mvt:comment> <mvt:assign name="l.settings:rotating_img_data" value="'[ { \"name\": \"Product1\", \"number\": \"5003", \"src\": \"http://www.clivecoffee.com/img/bio/ben.png\" }, { \"name\": \"Product1\", \"number\": \"5002", \"src\": \"http://www.clivecoffee.com/images/products/affirm-icon-product-page_2x.png\" }, { \"name\": \"Product1\", \"number\": \"5302", \"src\": \"http://www.clivecoffee.com/images/products/affirm-icon-product-page_2x.png\" }, ]'" /> <mvt:assign name="l.success" value="miva_json_decode(l.settings:rotating_img_data, l.settings:salespersons)" /> <mvt:comment>Assign array length</mvt:comment> <mvt:assign name="l.salespersons_count" value="miva_array_elements( l.settings:salespersons )" /> <mvt:comment>Shuffle array attempt</mvt:comment> Before:<br><mvt:eval expr="decodeattribute(glosub(miva_array_serialize(l.settings:salespersons), ',', '<br>'))" /><br> <mvt:foreach iterator="salesperson" array="salespersons"> <mvt:assign name="g.tempRand" value="random(l.salespersons_count - 1)" /> <mvt:assign name="g.tempVal" value="l.settings:salesperson" /> <mvt:assign name="l.settings:salesperson" value="l.settings:salespersons[g.tempRand]" /> <mvt:assign name="l.settings:salespersons[g.tempRand + 1]" value="g.tempVal" /> </mvt:foreach> After:<br><mvt:eval expr="decodeattribute(glosub(miva_array_serialize(l.settings:salespersons), ',', '<br>'))" /><br>
 
View "Basket #9702"
<mvt:assign name="g.string" value="'123,312,45,656'" /> <mvt:assign name="g.array" value="miva_array_deserialize( g.string )" /> &mvt:global:array[1];<br> &mvt:global:array[2];<br> &mvt:global:array[3];<br> &mvt:global:array[4];<br> <mvt:assign name="l.settings:fields" value="g.array" /> <mvt:assign name="g.fields_join" value="''" /> <mvt:foreach iterator="field" array="fields"> <mvt:if expr="g.fields_join NE ''"> <mvt:assign name="g.fields_join" value ="g.fields_join $ ','" /> </mvt:if> <mvt:assign name="g.fields_join" value="g.fields_join $ l.settings:field" /> </mvt:foreach> &mvt:global:fields_join;
 
View "Basket #7657"
<mvt:assign name="g.test" value="'caleb'" /> <mvt:assign name="g.test" value="NULL" /> when assigned to NULL (g.NULL empty) : &mvt:global:test;</br></br> <mvt:assign name="l.NULL" value="3" /> <mvt:assign name="g.test" value="NULL" /> when assigned to NULL (g.NULL value) : &mvt:global:test;</br></br> <mvt:assign name="g.test" value="''" /> when assigned to empty string: &mvt:global:test;</br></br>
 
View "Split/Explode String into Array"
<mvt:assign name="g.string" value="'1|2|3|4|5'" /> <mvt:assign name="g.delimiter" value="'|'" /> <mvt:do file="g.Module_Library_Utilities" name="l.null" value="SplitString( g.string, g.delimiter, g.array )" /> &mvte:global:array[1];<br> &mvte:global:array[2];<br> &mvte:global:array[3];<br> &mvte:global:array[4];<br> &mvte:global:array[5];<br> <hr/> <mvt:assign name="g.string_again" value="glosub( g.array, ',', '|' )" /> &mvt:global:array;<br> &mvte:global:string_again;<br>
 
View "Split/Explode String into Array"
<mvt:assign name="g.string" value="'1|2|3|4|5'" /> <mvt:assign name="g.delimiter" value="'|'" /> <mvt:do file="g.Module_Library_Utilities" name="l.null" value="SplitString( g.string, g.delimiter, g.output_array )" /> &mvte:global:output_array[1];<br> &mvte:global:output_array[2];<br> &mvte:global:output_array[3];<br> &mvte:global:output_array[4];<br> &mvte:global:output_array[5];<br>
 
View "Split/Explode String into Array"
<mvt:assign name="g.string" value="'1,2,3,4,5'" /> <mvt:assign name="g.array" value="miva_array_deserialize( g.string )" /> &mvt:global:array[1];<br> &mvt:global:array[2];<br> &mvt:global:array[3];<br> &mvt:global:array[4];<br> &mvt:global:array[5];<br>
 
View "Basket #315"
<mvt:assign name="g.string" value="'1600cc'" /> <mvt:assign name="g.search" value="'cc'" /> <mvt:assign name="g.foo" value="indexof( g.search, g.string, 1 )" /> &mvte:global:foo;