View Full Version : Scripting, MVT and other questions
Mike521
07-17-06, 08:40 PM
Hello, this thread is partially a copy of one that I made in the MM5 forum -- was advised that my questions are best placed here.
Anyway I just switched to MM5 and have been getting used to it today. I'm trying to learn this scripting syntax. I see there is a ton of <mvt:> statements. Is there any do***entation available on the syntax here, creation of variables, etc?
To be specific, I need to do the following, in various places:
1. output the current product being viewed
2. test to find out what screen I'm currently looking at
3. grab variables that have been posted (like a search term)
4. grab all products in the cart (names and prices)
5. grab order number (at the invoice screen)
also what do I do if I simply want to display a slightly different header / footer combo on product pages, etc?
last but not least, the old "multiple columns on category display" question -- anyone have a code example laying around?
Thanks all
For the category layout, look at Bruce's post at
http://extranet.miva.com/forums/showthread.php?t=2625
For variables, if they exist, you display them like
&mvt:product:name;
or
&mvt:global:screen;
or
&mvt:global:search;
There are some examples of code for basket contents or you can just go with a module like the mini-basket display.
Mike521
07-18-06, 04:52 PM
so is there no technical do***entation on this SMT, in terms of syntax, built in variables, built in functions, etc?
the help pages I looked at are not technical enough in that aspect.
Bruce - PhosphorMedia
07-18-06, 05:32 PM
What help pages are you referring to...
the do***entation is a bit splintered, but between the Help (http://docs.smallbusiness.miva.com/en-US/merchant/5/webhelp/MM5_Table_of_Contents.htm) (linked from the Admin), the tips (http://smallbusiness.miva.com/support/tips_tricks)at and this forum, one should have enough information to do what one can do with SMT methods.
SMT is not a scripting langauge and has limited functions. If you are looking to do something more complex, you probably need to look into learning Mivascript and how to build modules for MM5....which is another topic that has been repeatedly commented on in the forums.
Mike521
07-18-06, 06:01 PM
ok, looks like mivascript is the next step for me, thanks
DanLynn
07-20-06, 04:12 PM
A real quick general overview on what you're looking at is this:
&mvt: &mvte: and &mvta: all kinda say "Write the contents of the variable here", so, at the top, where it says &mvt:store:name; it outputs the name of the store.
&mvte: and &mvta: handle the variable differently (I don't remember how off-hand). I've accidentally used them interchangably and it never did anything. I think it has to do with if it evaluates the variable first.
<mvt:item> tags call components. <mvt:item name="navbar" /> brings up the Navigation Bar. Some components also require a parameter and some are left open and need to be closed, like:
<mvt:item name="fonts" param="body_font">
Some text here
</mvt:item>
And the other big one is this:
<mvt:if expr="g.Action EQ 'ADPR'">
some action
<mvt:else>
other action
</mvt:if>
From there, you'll probably also want to know what variables are available. the latu_storehelper module is a god-send for that. I don't have a link off-hand, but it shouldn't be hard to find. A lot of people use it.
Mike521
07-20-06, 04:23 PM
thanks for the quick review, I appreciate it! I'll check out that module also
Mike521
09-12-06, 05:50 PM
hey all, I'm getting back into this after taking a break from it for a while. I have a simple question for starters, how do I just define my own variable? for example
<mvt:if expr="g.Action EQ 'ADPR'">
<myvariable = myvalue>
<mvt:else>
<myvariable = myothervalue>
</mvt:if>
also I don't suppose there's a switch structure available is there?
DanLynn
09-12-06, 06:55 PM
To the best of my knowledge, you can't. Not in the templates anyway. You can do it in modules with the command MvAssign, or pass them in the url on to the next page, but not in templates.
If I'm wrong, someone please post it, but nothing I've found has suggested I am... sadly.
Mike521
09-12-06, 07:00 PM
alright, I found a toolkit module that has some functions that I think will be useful, one of which allows us to create our own variables. Guess I'll pick it up!
The Emporium Plus Tool Kit does that and a whole lot more.
http://www.emporiumplus.com/go/wcw/PROD/1AA/1AA00223
Mike521
09-12-06, 07:13 PM
just ordered :) thanks
vBulletin® v3.7.4, Copyright ©2000-2008, Jelsoft Enterprises Ltd.