In the past there was always a line drawn in the sand between the Miva scripting language and the storemorph language that you use in your Miva Merchant store pages. Not so any longer. For the past couple of years all built in Miva script functions have been available to us in the storemorph page building language in Miva Merchant.
In this short article, I'll explain how to display the date in your Miva Merchant pages.
I'm going to be referencing Miva script system variables. A list of them can be found here: http://www.mivascript.com/topic/system-variables.h...
First, to display a normal date string:
<mvt:eval expr="s.dyn_stm_mon $ ' ' $ s.dyn_tm_mday $ ', ' $ s.dyn_tm_year"/>
This will display the date in this format: Dec 15, 2015
If you want to display the month in it's entirety, you'll need to add a loop that sets a variable based on what month it is and then displays it. Note that there are single quotes around the full names of the months. This is necessary because without the single quotes the storemorph system will treat those month names as variables (and they would be empty so you'd never get your month displayed correctly.)
<mvt:if expr="s.dyn_tm_mon EQ 1">
<mvt:assign name="l.settings:month" value="'January'" />
<mvt:elseif expr="s.dyn_tm_mon EQ 2">
<mvt:assign name="l.month" value="'February'" />
<mvt:elseif expr="s.dyn_tm_mon EQ 3">
<mvt:assign name="l.month" value="'March'" />
<mvt:elseif expr="s.dyn_tm_mon EQ 4">
<mvt:assign name="l.month" value="'April'" />
<mvt:elseif expr="s.dyn_tm_mon EQ 5">
<mvt:assign name="l.month" value="'May'" />
<mvt:elseif expr="s.dyn_tm_mon EQ 6">
<mvt:assign name="l.month" value="'June'" />
<mvt:elseif expr="s.dyn_tm_mon EQ 7">
<mvt:assign name="l.month" value="'July'" />
<mvt:elseif expr="s.dyn_tm_mon EQ 8">
<mvt:assign name="l.month" value="'August'" />
<mvt:elseif expr="s.dyn_tm_mon EQ 9">
<mvt:assign name="l.month" value="'September'" />
<mvt:elseif expr="s.dyn_tm_mon EQ 10">
<mvt:assign name="l.month" value="'October'" />
<mvt:elseif expr="s.dyn_tm_mon EQ 11">
<mvt:assign name="l.month" value="'November'" />
<mvt:elseif expr="s.dyn_tm_mon EQ 12">
<mvt:assign name="l.settings:month" value="'December'" />
</mvt:if>
<mvt:eval expr="l.settings:month $ ' ' $ s.dyn_tm_mday $ ', ' $ s.dyn_tm_year"/>
This will display the date in this format: December 15, 2015
That's a lot of code to have cluttering up your header or footer, however you can take that out of your page and use it as a content block using our ProContent modue (yes, a blatant sales pitch, but the ProContent module is super powerful for this type of stuff.)
If you were to use the ProContent module, you could create a content block with that code called <strong>current_date</strong>
and display your date anywhere in your store with nothing more than a simple page item:
<mvt:item name="procontent" param="current_date" />
Happy coding!