Scot's Scripts FAQs and Module Support

If you don't find the answers here contact us.
Documentation and support for our Miva modules is found here. If you can't find the answer you're looking for contact us and we'll add the information.

MM5 Tips & Tricks / mvt:assign and mvt:eval

mvt:assign and mvt:eval

Finally.

We can now easily assign and display variables in Miva Merchant pages. And, every other built in Mivascript function. Some of those functions that might be useful include:

  • math functions
  • encoding and decoding html characters
  • encoding and decoding URLs
  • testing for numbers, letters, uppercase, lowercase
  • using time and date functions

mvt:assign

One of the first things you might use this for is to number lists such as search results. At the top of the foreach loop you would put:

<mvt:assign name="l.counter" value="l.counter + 1" />

Display the counter variable above by using the mvt:eval tag.

<mvt:eval expr="l.counter" />

Most of you who need to assign varaibles probably already use a toolkit module to do so. Just know that there's a better way.

mvt:eval

One if the nice things about mvt:eval is that you can display system variables such as current year for a hands-off copyright approach.

copyright <mvt:eval expr="s.dyn_tm_year" /> by Scot's Miva Scripts
Random Images

Use mvt:eval to display a random image each time a page loads. Put a bunch of images that are named in numerical order (1.jpg, 2.jpg, 3.jpg, etc..) and then use this code to display a random image.

<mvt:assign name="l.random" value="random(10)" />
<img src="slides/&mvt:local:random.jpg">
Remember that both of these tags need to have the closing / at the end.
updated May 16, 2013