Browse All Fiddles


Basket #57070

Created: 1506362623
View "Basket #57070"
<mvt:assign name= "g.color" value = " 'red' " /> <mvt:assign name= "g.test1" value = " 1 " /> <mvt:assign name= "g.test2" value = " 2 " /> <mvt:if expr="g.test1 EQ 1 OR g.test2 EQ 2"> &mvt:global:color; </mvt:if>
 

Basket #61307

Created: 1506099007
View "Basket #61307"
<mvt:assign name="g.list" value="'9.95,89.95,24.99'" /> <mvt:assign name="l.count" value="1" /> <mvt:assign name="l.token" value="gettoken(g.list, ',' , l.count)" /> <mvt:while expr="NOT ISNULL l.token"> <mvt:assign name="l.array_length" value="miva_array_insert( l.settings:my_array, l.token, -1 )" /> <mvt:assign name="l.count" value="l.count + 1" /> <mvt:assign name="l.token" value="gettoken(g.list, ',' , l.count)" /> </mvt:while> <mvt:assign name="l.settings:subtotal" value="'0'" /> <mvt:foreach iterator="array_element" array="my_array"> <mvt:assign name="l.settings:subtotal" value="l.settings:subtotal + l.settings:array_element"/> </mvt:foreach> <br/> <hr>SUBTOTAL:&mvt:subtotal;
 

Basket #61228

Created: 1506048686
View "Basket #61228"
<mvt:assign name="l.what" value="'toupper(apples)'" /> <mvt:assign name="l.output" value="miva_variable_value( 'apples' )" /> <mvt:eval expr="l.output" />
 
View "YYYY-MM-DD to DD/MM/YYYY"
<mvt:assign name="l.settings:event_date:yyyymmdd" value="'2017-09-19'" /> <mvt:do file="g.Module_Library_Utilities" name="l.result" value="SplitString( l.settings:event_date:yyyymmdd, '-', l.settings:event_date:parts )" /> <mvt:if expr="miva_array_elements(l.settings:event_date:parts) EQ 3 AND len(l.settings:event_date:parts[1]) EQ 4"> <mvt:assign name="l.settings:event_date:mmddyyyy" value="l.settings:event_date:parts[2] $ '/' $ l.settings:event_date:parts[3] $ '/' $ l.settings:event_date:parts[1]" /> </mvt:if> <h2>&mvt:event_date:mmddyyyy;</h2> <mvt:eval expr="glosub(miva_array_serialize(l.settings:event_date), ',', '<br>')" />
 
View "Snippet: 1505764013 - v1"
<mvt:eval expr="crypto_md5( 'hi ann' )" /><br /> <mvt:eval expr="crypto_md5( 'hi ann' )" /><br /> <mvt:eval expr="crypto_md5( 'hi ann' )" /><br />
 

Basket #53360

Created: 1505763985
View "Basket #53360"
<mvt:eval expr="crypto_md5( 'hi ann' )" /><br /> <mvt:eval expr="crypto_md5( 'hi ann' )" /><br /> <mvt:eval expr="crypto_md5( 'tguefen@miva.com' )" /><br />
 

While Loop

Created: 1505752077
View "While Loop"
<mvt:while expr="l.settings:counter LT 5"> <mvt:assign name="l.settings:counter" value="l.settings:counter + 1" /> &mvt:counter;<br> </mvt:while>
 

Basket #58107

[Documentation](http://www.miva.com/template-language/miva_template_language/entities_&_encoding.html) [Tutorial](http://www.miva.com/videos/web_developers/entities)
Created: 1505432218
View "Basket #58107"
&mvte:global:theme_path;
 
View "Miva Array Difference with miva_array_filter()"
<mvt:assign name="l.settings:lists:small" value="miva_array_deserialize('Apples,Bananas,Carrots')" /> <mvt:assign name="l.settings:lists:big" value="miva_array_deserialize('Apples,Bananas,Carrots,Lemons,Limes,Oranges')" /> <mvt:assign name="l.result" value="miva_array_filter( l.settings:lists:big, 0, l.big_item, 'NOT miva_array_find( l.big_item, l.settings:lists:small, 0 )', l.settings:lists:difference )" /> <mvt:eval expr="glosub(miva_array_serialize(l.settings:lists), ',', '<br>')" />
 

Basket #59355

Created: 1505321387
View "Basket #59355"
&mvte:global:Screen;
 

Basket #58852

Created: 1505154402
View "Basket #58852"
<mvt:assign name="l.settings:advancemonth" value="padl(s.dyn_tm_mon, 2,0)"/> <mvt:assign name="l.settings:thisday" value="padl(s.dyn_tm_mday, 2,0)"/> <mvt:if expr ="l.settings:advancemonth EQ 1"> <mvt:assign name="l.settings:over28" value="'29,30,31'"/> <mvt:if expr ="l.settings:thisday CIN l.settings:over28"> <mvt:assign name="l.settings:thisday" value="'28'"/> </mvt:if> <mvt:else> <mvt:assign name="l.settings:over30" value="'31'"/> <mvt:if expr ="l.settings:thisday CIN l.settings:over30"> <mvt:assign name="l.settings:thisday" value="'30'"/> </mvt:if> </mvt:if> <mvt:if expr ="l.settings:advancemonth EQ 12"> <mvt:assign name="l.settings:advancemonth" value="'01'"/> <mvt:else> <mvt:assign name="l.settings:advancemonth" value="l.settings:advancemonth+1"/> </mvt:if> <mvt:assign name="g.YMDDate" value="s.dyn_tm_year$'-'$l.settings:advancemonth$'-'$l.settings:thisday"/> <mvt:comment> ###### This writes YYYY-MM-DD format one month in advance. ###### </mvt:comment> <mvt:comment> ###### IF the order was placed on January 29,30,31 it will advance the date to February the 28th. ###### </mvt:comment> <mvt:comment> ###### ELSE if the order was placed on the "31st" it will advance the date one month to the 30th. ###### </mvt:comment> &mvt:global:YMDDate;
 

Basket #58345

Created: 1504930620
View "Basket #58345"
<mvassign name="l.foo" value="HEY"></mvassign> <mveval expr="{ l.foo }"> </mveval>
 
View "Basket #48599"
<mvt:assign name="g.string" value="'cat, dog bob edward sally'" /> <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>
 

Basket #57957

Methods for splitting strings to arrays
Created: 1504715800
View "Basket #57957"
<mvt:assign name="g.array[1]" value=" 'apple' "/> <mvt:assign name="g.array[2]" value=" 'orange' "/> <mvt:assign name="g.array[3]" value=" 'banana' "/> &mvt:global:array; <mvt:assign name="g.randomFruit" value="g.array[ random( miva_array_max(g.array) ) ]" /> &mvte:global:randomFruit; <mvt:assign name="l.settings:number" value="random(3)" /> &mvt:number;
 

Basket #57815

Created: 1504626012
View "Basket #57815"
<mvt:assign name="g.time_zone" value="'-5'" /> <mvt:assign name="g.dailypgrp" value=" 'DailyDeal' $ time_t_dayofmonth(dyn_time_t,time_zone) " /> &mvt:global:dailypgrp;
 

Basket #57351

Created: 1504300602
View "Basket #57351"
<mvt:assign name="g.string" value=" 'Miva Merchant, Version 9 ,is the current version of Miva Merchant.' " /> <mvt:assign name="g.new_string" value="glosub(g.string, ',' , '')" /> &mvt:global:new_string;
 

Basket #57209

Simply changes any order_Status that is "Pending" to "In Progress"
Created: 1504214967
View "Basket #57209"
<mvt:assign name="l.settings:scrubme" value="'I am a really long and boring sentance.'"/> <mvt:assign name="g.return_value" value="substring( l.settings:scrubme, 0, 10 )" /> &mvt:global:return_value;
 

Basket #56990

Created: 1504048136
View "Basket #56990"
<mvt:comment> <!-- Welcome to Miva <snippets/> You can enter standalone blocks of Miva template code then Run or Save your code to see the result. Try inserting a snippet by clicking an Insert from the left or select the Learn/Browse menu items to see some examples --> </mvt:comment>
 
View "Basket #56916"
<mvt:assign name="g.saProdCategories[1]" value="'Gear Set'" /> <mvt:assign name="g.saProdCategories[2]" value="'Jerseys'" /> <mvt:assign name="g.saProdCategories[3]" value="'Pants'" /> <mvt:assign name="g.saProdCategories[4]" value="'Gloves'" /> <mvt:assign name="g.saProdCategories[5]" value="'Guards & Braces'" /> <mvt:assign name="g.saProdCategories[6]" value="'Chest Protectors'" /> <mvt:assign name="g.saProdCategories[7]" value="'Base Layers'" /> <mvt:assign name="g.saProdCategories[8]" value="'Casual Shirts'" /> <mvt:assign name="g.saProdCategories[9]" value="'Casual Pants'" /> <mvt:assign name="g.saProdCategories[10]" value="'Hats'" /> <mvt:assign name="g.saProdCategories[11]" value="'Socks'" /> <mvt:assign name="g.saProdCategories[12]" value="'Shoes'" /> <mvt:assign name="g.saProdCategories[13]" value="'Boots'" /> <mvt:assign name="g.saProdCategories[14]" value="'Goggles'" /> <mvt:assign name="g.pCat" value="'Boots'" /> Category : &mvt:global:pCat;<br/> POS: <mvt:eval expr="miva_array_search( g.saProdCategories, 1, l.saCategory, 'l.saCategory EQ \'' $ g.pCat $ '\'' )" /> <mvt:eval expr="l.attribute"/>
 
View "Snippet: 1503688457 - v2"
<h2>Static</h2> <mvt:do file="g.Module_Library_DB" name="l.success" value="Product_Load_ID( '1', l.settings:product )" /> <mvt:eval expr="l.settings:product:code" /> <br> ==================================================== <br> <h2>Dynamic</h2> <mvt:assign name="g.fn" value="'Product_Load_ID'" /> <mvt:do file="g.Module_Library_DB" name="l.success" value="g.fn('1', l.settings:test)" /> <mvt:eval expr="l.settings:test:code" />
 

Basket #56665

 math
Created: 1503680577
View "Basket #56665"
<mvt:assign name="l.settings:roundme" value="8.95" /> <mvt:eval expr="l.settings:roundme ROUND 0" /><br/> <mvt:do name="l.result" file="g.Module_Root $ g.Store:currncy_mod:module" value="CurrencyModule_AddFormatting( g.Store:currncy_mod, 1.25 )" />
 
View "Basket #56616"
<mvt:assign name="l.settings:attributes[1]:siteId" value="''" /> <mvt:assign name="siteId" value="'123'" /> <mvt:assign name="l.settings:attributes[2]:templateId" value="'12333'" /> <mvt:assign name="l.settings:attributes[3]:currentPageUrl" value="'0'" /> <mvt:assign name="l.settings:saParameter" value="l.settings:attributes" /> <mvt:assign name="g.var" value="'foo'" /> <mvt:do file="g.Module_JSON" name="l.success" value="JSON_Encode(l.settings:saParameter)" /> <mvt:eval expr="success"/>
 
View "Basket #56548"
<mvt:assign name="l.parameter[1]" value="'{\"config\":{\"siteId\": \"7850070\",\"templateId\": \"221\",\"currentPageUrl\": \"0\"},\"productId\":\"\'&mvt:product:Code\'\"}'" /> <mvt:eval expr="l.parameter"/>
 
View "Basket #55998"
<mvt:call action="'//s28.socialannex.com/v2.0/review/getReviews'" method="'POST'" fields="'parameter={\"config\":{\"siteId\": \"7850070\",\"templateId\": \"221\",\"currentPageUrl\": \"0\"},\"productId\":\"122\"}'"> <mvt:eval expr="s.callvalue" /> </mvt:call>
 

Basket #55979

capitalize a string
Created: 1503004065
View "Basket #55979"
<h2>MivaScript MOD</h2> <p>MivaScript has a built in Modulus opperator: <code>MOD</code></p> <mvt:assign name="l.settings:total_ports" value="112" /> <mvt:assign name="l.settings:total_blocks" value="floor((l.settings:total_ports -1) / 24) +1" /> <code>total blocks:</code>&mvt:total_blocks;<br></br> <mvt:if expr="l.settings:total_ports GE 112"> <code>wait! please call us</code> </mvt:if>