|
PCI Net ToolbeltTM OverviewWhat is Toolbelt?"If I have seen further, it is by standing on the shoulders of giants." -- Sir Isaac Newton
Toolbelt is used in hundreds of Miva Merchant web stores to add functionality and manipulate data and site layout. What's in this guide?Rather than assume you know all about Page, Items, and Functions and programming, this guide provides the core information you need in a single resource as well as serving as a complete function reference guide. Store Morph is easy to learn. All you need is a basic knowledge of HTML and a few programming concepts. Toolbelt makes Store Morph a more complete scripting language and a knowledge of programming, while not essential will make the concepts presented here easier to understand. Parts of this document are excerpts from the Miva Merchant 5 Documentation and MivaScript Guide 4.0x. They and reproduced here with the permission of Miva Merchant. Toolbelt Examples:This guide presents dozens of examples. I recommend that you set up a new Page Template with a page code called TEST, where you can try things out without interfering with your store. You will be able to view the test page by navigating to http://www.YourStoreName.com/mm5/merchant.mvc?page=TEST. Make sure you click the Items tab, find ry_toolbelt and assign it to the page by clicking the checkbox and clicking [Update] Installation:
Upgrading:
How to:If you have never edited a Store Morph Page Template before you should review the Miva Merchant 5 documentation and browse to UI/Store Design/Store Morph Technology. If that looks like too much reading, let's just jump in. How to add Items to a pageLet's add a few useful buttons to the basket page. The normal process of editing pages will go something like this. In the Admin, click the "Pages" link to display the User Interface. Don't worry. Merchant will allow you to undo your changes and go back to a previous version. See Working with Version History for details.
Add the buttons [Continue Shopping] and [Checkout] to your Basket page.
In notepad change this...
<tr><td align="left" valign="top" width="100%">
<br>
<mvt:item name="basket" />
</td></tr>
to this...
<tr><td align="left" valign="top" width="100%">
<br>
<mvt:item name="basket" />
<mvt:if expr="NOT l.settings:basket:empty">
<div style="float: right">
<mvt:item name="ry_toolbelt" param="basketbuttons|checkout|Checkout|mybtn" />
</div>
<div>
<mvt:item name="ry_toolbelt" param="basketbuttons|continue_lastprod|Continue|mybtn"/>
</div>
</mvt:if>
</td></tr>
Click [Update]. In your store add a product to the basket, then browse to the basket page. Right click on the
page and select View Source, to examine the html.On the Admin Edit Page, click the tab PCInet Tool Belt*, click the BasketButtons link and read more about this item. Where to:Where can you use the PCI Net Toolbelt? Almost anywhere you find a text box in Merchant Admin, IF you have it assigned to every page template. Edit the BASK Page then click the Items tab. You will find every item assigned to the page has a checked box. Each Item adds functionality to the page and normally has an associated <mvt:item /> tag in the template. For Example: the basket item, when checked adds the Basket Contents tab which lets you edit the way the basket displays. In the page template you should see the item as <mvt:item name="basket" />. Likewise you should check the box next to ry_toolbelt to assign it to the page. Toolbelt items/functions work the same way. For example: On the product page you will find the entity &mvt:product:name; (see entities below). This corresponds to the variable l.all_settings:product:name. If you always wanted to make sure product names were capitalized regardless of what was entered in the database, you can use the eval item and the capitalize() function. <mvt:item name="ry_toolbelt" param="eval|capitalize(l.all_settings:product:name, ' ')" /> You can use Toolbelt items on any page template, category tree, global header / footer, category and product header or footer and more. Toolbelt will NOT work in some third party module text areas or text areas that have nothing to do with page display, like shipping settings. Store Morph Items:Page items are the methods you will use to access the features of Store Morph and Toolbelt. An item is a single element in a template that makes up a distinct part of the page. It can be as simple as assigning a variable... <mvt:item name="ry_toolbelt" param="assign|g.ProdName|l.all_settings:product:name" /> OR can call up an entire section of the page where the settings are configured in another tab. For example, when the basket item is assigned to a page, a new tab is displayed call Basket Contents. This tab provides a sub-template where you can configure the basket layout. To use the item, you add the item command to the template. <mvt:item name="basket" /> Open and Close Items: Some Store Morph items come in pairs just like HTML tags, with (e.g. <b>This is Bold</b>). Omitting a closing tag will cause the page compiler to report an error when you save the page. For Example: <mvt:item name="body"> ...Page content... </mvt:item> Empty Items are stand alone commands in that they perform a single operation. These items all end with a closing right slash (e.g. />) Note the difference in the Basket and Body items above. Toolbelt Items are all empty items that perform a single operation. Entities:These badly named language elements represent the combination of an output statement and variable having the syntax of &mvt:product:code; or &mvt:global:product_code; This would be roughly equivalent to JavaScript's document.write(product:code). These two forms represent the scope of the variable where the former is stored internally as a local variable l.settings:product:code and the latter is stored globally as g.Product_code. There is however a third form of the variable that is used by all third party modules like Toolbelt (i.e. l.all_settings:product:code). For now all you need to know is that &mvt:variableName; is how you write the variable to the page. For more information, see the section on variables. CommentsYou can add comments or comment out sections of the page using <mvt:comment> and </mvt:comment>, however there is a bug in the page compiler which lets certain items "leak" through to the screen. This usually occurs when the commented section contains an entity representing a URL or a third party module. In those cases add html comments to hide the leak from display as shown. <!-- <mvt:comment> ...hidden content... </mvt:comment> --> Variables:Do you remember algebra from school? x=4, y=6, z=x+y The letters in the equations above are variables (like x) that hold a value (like 4) that you can use to hold information to calculate the value of another variable (like z= 4 + 6). The equation above is called an expression (like x+y). As with algebra, Store Morph variables are used to hold values which can be strings, numbers, or other variables. Variables can be populated by a simple assignment (like x=5 or tree="oak") or by the result of an expression (like z=x+y). T Toolbelt gives you access to variables via the assign and eval items. Variable Names:A variable can have a short name, like g.x, or a more descriptive name, like l.settings:product:code, but all variable names follow these rules:
Prefixes in the variable name define its scope in the current page. The prefixes are:
The variables starting with l.settings contain Merchant data structures used internally by Store Morph. They can only be used inside if expressions. The variables starting with l.all_settings, are a copy (by reference. see below) of l.settings. Merchant makes this variable available to third party modules. Toolbelt always uses this form. Data Types and Type Checking: Store Morph data types are loosely defined and can be easily interchanged. This can lead to unexpected errors. In the example below the variable g.value can be treated as a string or a number. assign|g.value|'100'
The Varlist Item: What was that variable name?It is impossible to remember all of the entities available to a Store Morph page so Toolbelt provides a powerful inspection tool for debugging variables called varlist. Simply add the lines of code below to the bottom or your page templates before the last </mvt:item></html> tags. Display Local Variables: <mvt:item name="ry_toolbelt" param="varlist|local" /> All local variables will be de-constructed, sorted and displayed in human readable form showing the variable name, entity name and variable contents. To disable the item without removing it from the page, simply put an X in front of the last parameter and it will be ignored. Don't display: <mvt:item name="ry_toolbelt" param="varlist|Xlocal" /> HINT: Place all three commands in a conditional using your IP address and ONLY YOU will see the results. <mvt:if expr="s.Remote_Addr EQ '66.123.45.678'"> <mvt:item name="ry_toolbelt" param="varlist|local" /> <mvt:item name="ry_toolbelt" param="varlist|global" /> <mvt:item name="ry_toolbelt" param="varlist|Xsystem" /> </mvt:if Disable the entire output by putting an X in the IP address. Disable the individual items by putting and X in front of the keyword (e.g. local becomes Xlocal) The Varlist() Function: As of version 5.34 a new function has been added that provides a search parameter, reducing the size of the output. Scope = 'l', 'g', or 's'. search = variable(s) to display, l.all_setting = required. <mvt:item name="ry_toolbelt" param="eval|varlist('scope', 'search', l.all_setting)" />
<mvt:item name="ry_toolbelt" param="eval|varlist('l', 'store', l.all_settings)" />
<mvt:item name="ry_toolbelt" param="eval|varlist('g', 'module', l.all_settings)" />
Variables by Reference ( VAR or var ):When using functions, variables are often passed as parameters. But, in some functions, a parameter may be defined internally using an optional "VAR" or "var" statement after the variable name. This signifies that the parameter variable would be passed by reference. Any changes to the variable within the function will be applied in the variable when the function returns. This means string, numbers or entire arrays and structures can be returned inside the variable used in the function. Example: file_read(filepath, location, data var)
"assign|g.length|file_read('/mm5/teamnames.txt', 'script', g.baseball_teams)"
g.length contains length of the files and g.baseball_teams contains the file data.
Toolbelt makes extensive use of the feature. You pass an empty variable and Toolbelt returns the results in the same variable as a structured array. Some of the functions detailed below also use this feature. Assign by Reference { }: The assign item has a special syntax that allows you to construct a string representation of a new variable name using expressions. After assigning the string to a variable, you can then assign value to the constructed reference variable. The implication is that it becomes easy script complex variable names and then assign values to them; in short, dynamic variable names. <mvt:item name="ry_toolbelt" param="assign|g.refvar|'g.url'" />;
<mvt:item name="ry_toolbelt" param="assign|{ g.refvar }|'http://www.pcinet.com/'" />;
&mvt:global:url; displays http://www.pcinet.com/
Expressions:Expressions can contain variables, literal values (text or numbers), functions, and operators, which indicate how the other components in the expression are to be evaluated. Expressions are evaluated and return a result that can be assigned to a variable using the assign item or output to the page using the eval item. They can evaluate a condition as false (0 or null) or true (not 0 or null). You can then take action on the results. See the MivaScript 4.0x Reference Guide. It's badly out of date but is a prime reference resource. Syntax: Spaces in an expression are not evaluated unless the spaces are an intrinsic part of the data being evaluated. Spaces are simply separators between parts of the expression. In Toolbelt, nearly every parameter can be evaluated as an expression. Some functions however accept specific keywords. Using the assign statement below expression can consist of many things. <mvt:item name="ry_toolbelt" param="assign|g.varname|expression" /> Expression Examples: Strings: String literals are always enclosed in single quotes; the $ operator is used to add strings
together. String functions: Literals and variables can be combined. Null Strings: Remove all colons from a string by replacing them with a null string (two single quotes e.g.
''). Nested Functions: Trim leading spaces, get the characters before the first hyphen and convert to uppercase. Numeric Expression: (l.all_settings:product:cost * g.markup) ROUND 2 Special characters: Store Morph has trouble with certain characters like the ampersand & single and double quotes in expressions.The ampersand causes a compiler error: <mvt:item name="ry_toolbelt" param="assign|g.url|g.sessionurl $ '&screen=BASK" /> Alternative: <mvt:item name="ry_toolbelt" param="assign|g.url|g.sessionurl $ asciichar(38) $ 'screen=BASK'" /> While using asciichar(38) instead of & works, it a bit cumbersome in a long URL with lots of parameters. In this example the ampersand & was replaced with the tilde ~. Assuming there were lots of tildes, they can all be replaced at once using the glosub() function. The same technique can be used with embedded quotes and apostrophes. Better solution: <mvt:item name="ry_toolbelt" param="assign|g.url|g.sessionurl $ '~screen=BASK' $ more..." /> <mvt:item name="ry_toolbelt" param="assign|g.url|glosub(g.url,'~',asciichar(38))" /> A chart of ascii character codes can be found here. If elseif else:In all programming languages comparisons form the basis for flow control, determining code to execute and what code to skip. Store Morph has a single language construct for flow control, the opening if, elseif, else and closing /if statements. <mvt:if expr=" condition ">
do this...
<mvt:elseif expr=" condition "> (optional)
do this
<mvt:else> (optional)
do this...
<mvt:if expr=" condition ">
do this
</mvt:if>
</mvt:if>
The else if and else portions are optional but a closing tag </mvt:if> must be used. As shown in the example above, conditionals may be nested. The expr parameter must evaluate as a valid expression where false is defined as zero or null and true is defined as not zero or not null. The Operators section below provides example of conditional expressions. Operators:Operators are a symbol or symbols used to operate on data, most often in an <mvt:if> statement. Store Morph provides a reasonable set of operators but Toolbelt provides access to the rest of them defined in MivaScript. Every operatory is not listed here. See the MivaScript Reference Guide for full details.
<mvt:if expr="g.Basket:cust_id EQ 0">
Customer is not logged in
</mvt:if>
<mvt:if expr="NOT ISNULL l.settings:product:image">
<img src="&mvt:product:image;" alt="&mvt:product:name;">
</mvt:if>
<mvt:if expr="',' $ g.Screen $ ',' IN ',OUS1,OUSM,OSEL,OPAY,OPRC,OINF,OCST,ORDL'">
This is a checkout page.
</mvt:if>
<mvt:if expr = "(pos1 MOD 3 ) EQ 0">
This is the third item.
</mvt:if>
Operator PrecedenceFrom highest to lowest MivaScript Operators:
Arrays:Store Morph items very often return results from Merchant databases in the form of structured arrays. The Toolbelt varlist|local item will display all arrays loaded into memory. For instance, the basket total is stored in the variable l.all_settings:basket:total. While the first product code in the basket is stored in l.all_settings:basket:items[1]:code and the first attribute option for the first item is stored in l.all_settings:basket:items[1]:options[1]:opt_code. This type of structure (l.all_settings:table[n]:fieldname) is used throughout Merchant. Normally you won't need to create arrays or access them directly but will constantly need to read and output them. The Array functions are listed below. NOTE: All Store Morph arrays are 1 based. That is they start with [1]. There is no [0] element. Attempting to access a zero or negative array element will generate a runtime error. Use the function miva_array_max(array_name) to return the size of an array. Foreach loop:The foreach statement gives you a way to step through a collection of data stored in an structured array. <mvt:foreach iterator="product" array="products"> <mvt:comment> Display the code and name. </mvt:comment> &mvt:product:code;<br> &mvt:product:name;<br> </mvt:foreach> Notice the first line <mvt:foreach iterator="product" array="products"> where products (with an s) is the name of the array we are looping through and product (no s) contains the current item. (i.e. &mvt:product:code; does not have an s). Internally the template is looping through the array products[n]:fieldname and presenting a copy of the data record as product:fieldname. Unlike other languages Store Morph does NOT provide an &mvt:break; command to exit the loop early. All foreach loops continue to the end of the data. To overcome this problem, conditional statements can be added inside the loop so that selected records can be skipped. For loop:Where the foreach loop operates exclusively on array data, Toolbelt provides a way to create your own loop by preceding a foreach item with the for item. <mvt:item name="ry_toolbelt" param="assign|g.bigST|'CA|TX|FL|IL|NY'" /> <mvt:item name="ry_toolbelt" param="for|j=1 to 5 step 1" /> <mvt:foreach iterator="j" array="for_j"> &mvt:j;: <mvt:item name="ry_toolbelt" param="eval|gettoken(g.bigST,'|',l.all_settings:j)" /><br> </mvt:foreach> For loops are not limited to positive increments. The value of the start, end and step expressions can be positive or negative numbers. The step parameter is optional and defaults to 1 if omitted. This makes it possible, for example, to display an array in reverse order or skip every other line. <mvt:item name="ry_toolbelt" param="for|counter=start_exprsn to end_exprsn step incr_exprsn" /> External Data:There are already built in functions for retrieving and writing external data, so Toolbelt does not provide Import or Export items. Review the File System functions for more information, but a few of these are:
This example determines if a banned name was entered by the user. By using Ajax like techniques, user input was validated against an external list without refreshing the screen. The example below uses file_read() to load a test file, calculate the number of lines, create a loop, parse each name and compares it with g.name. It then outputs JavaScript variables. <mvt:item name="ry_toolbelt" param="assign
|g.length|file_read( '/mm5/banned_names.txt', 'script', g.banned )" />
<mvt:item name="ry_toolbelt" param="assign|
g.linecount|1 + g.length - len(glosub(g.banned,asciichar(10),''))" />
<mvt:item name="ry_toolbelt" param="for|i=1 to g.linecount" />
<mvt:foreach iterator="i" array="for_i">
<mvt:item name="ry_toolbelt" param="assign
|g.linein|trim(gettoken(g.banned,asciichar(10),l.all_settings:i))" />
<mvt:if expr="g.linein">
<mvt:item name="ry_toolbelt" param="assign
|g.bannedname|trim(gettoken(g.linein,asciichar(9),1))" />
<mvt:if expr="g.name EQ g.bannedname">
var ban_found = true;
var ban_error = "The name you selected is prohibited by Major League Baseball.";
<mvt:exit />
</mvt:if>
</mvt:if>
</mvt:foreach>
Loading Sub-Screens:Given a screen code, the screen item retrieves the contents of any page template and either displays it or stores the results in a variable. This means you can display a template at any location inside another page template. You can create re-usable sub-screens (i.e. mini basket, featured products) and display them as needed. <mvt:item name="ry_toolbelt" param="screen|screen_code" /> <mvt:item name="ry_toolbelt" param="screen|screen_code_exprsn|g.variable" /> The fact that you can store the results in a variable opens up many other possible uses. Toolbelt provides a number of extra Page Templates that make use of this feature.
More information can be found in the Screen Section below Calling Web Pages:Given a URL expression, the Call_Get item returns the contents of any web page as a variable. Once loaded the variable can be displayed as is or modified via script. Alternatively use Call_Post, data can be posted to another web page. This provides a mechanism for transmitting form data to another site. <mvt:item name="ry_toolbelt" param="call_get|g.webpage|url_exprsn" /> More information can be found in the Call Section below Do External Functions:Call any external function within any compiled MivaScript file with the Do item. Like MivaScripts MvDO tag or OpenUIs DOFUNC token, you can use this to directly access your own compiled MivaScript functions without having to write an entire module. You can even tap into Miva Merchants API if you can determine the correct call. <mvt:item name="ry_toolbelt" param="do|g.file_exprsn|g.result|Function_Name(var1,var2)" /> Exit:The <mvt:exit /> tag causes the code to terminate the current page or process, rather than continuing through the rest of the code on the page. <mvt:if expr="l.settings:basket:empty">
Your shopping basket is currently empty.<br>
<mvt:exit />
</mvt:if>
Function ReferenceMivaScript is the web language Miva Merchant and Store Morph is written in. As such, there are many functions built into the language that are not available to Store Morph templates without the help of Toolbelt. Toolbelt also adds many new functions of its own. There are two types of Toolbelt functions; Items like assign... <mvt:item name="ry_toolbelt" param="assign|g.var|expression" />and expression functions like capitalize(). <mvt:item name="ry_toolbelt" param="assign|g.var|capitalize(string, separator)" /> Review the section on expressions if the difference is not clear. Any Toolbelt item that can accept an variable or expression as a parameter will accept a function as a parameter. This section is devoted the later and includes additional functions added by Toolbelt. Passing Variables by Reference ( VAR or var ):When using functions, variables are often passed as parameters. But, in some functions, a parameter may be defined internally using an optional "VAR" or "var" statement after the variable name. This signifies that the parameter variable would be passed by reference. Any changes to the variable within the function will be applied in the variable when the function returns. This means string, numbers, or entire arrays and structures can be returned inside the variable used in the function. Example: file_read(filepath, location, data var)
"assign|g.length|file_read('/mm5/teamnames.txt', 'script', g.baseball_teams)"
g.length contains length of the files and g.baseball_teams contains the file data.
Toolbelt makes extensive use of the feature. You pass an empty variable and Toolbelt returns the results in the same variable as a structured array. Some of the functions detailed below also use this feature. Some of the functions below are hi-lighted in red. These functions are not part of MivaScript but have been added by Toolbelt. Debugging:Varlist Item and the Varlist() functions are provided to allow you to easily see the underlying variables and data structures. See Varlist Above. See Live Example here and Search Example here. Page Compiler popup errors are those frustrating Merchant message you get when trying to save a page template. Most of these errors are introduced while trying to edit third party page items like Toolbelt, but the template compiler produces an error message that is completely misleading. For example the compiler tells you you have a missing </mvt:if> tag leading you on a goose chase trying to figure out where you left one off, when the real error was an extra double quote or missing semi-colon 10 lines earlier. Use <mvt:comment> </mvt:comment> to block out whole sections of the page will save correctly, then moving the comments around a few lines or sections at a time till you locate the offending line. Compiler Bugs: When creating Toolbelt expressions, the compiler sometimes has a hard time with &, ", and ; characters forcing you to use the asciichar() function. Also some characters immediately after a closing item bracket (i.e. /> ) can cause problems. Strings:
Arrays:
Numbers:The arguments of the trigonometric functions sin, cos, tan, sinh, cosh, and tanh should be expressed in radians; the results of asin, acos, atan, and atan2 are expressed in radians. Function arguments in radians can be given in the range 0 to 2pi, or -pi to pi.
File System:In all of these functions, location is designated as one of the string literals 'data' or 'script'; where data refers to the mivadata folder and script refers to the html (web site) folder. For all file function:
Mivadata Folder:These functions all operate on the mivadata folder.
HTML Folder:These functions all operate on the html (web site) folder.
System Functions:
System Variables:Accessibility Codes
For example, E: C,N means that the variable in question is inherited from the environment and is accessible in the CGI and NSAPI versions of Miva Merchant Virtual Machine.
Time Functions:Note: These functions cannot be used to process dates earlier than January 1, 1970, or later than January 19, 2038.
Time Variables:
Inspection Validation:These functions all start with "is" and return a 1 (true) or 0 (false) value depending on the composition of the string. When any of these functions are applied to a string like isdigit(string), they return true if all characters in the string pass the test.
Encryption:These functions are poorly documented. The Miva forum may be your best resource for information.
More Page TemplatesIncluded in the download file ry_toolbelt.zip are several page template files for use in your store. While these are useful functional features, they also point the way to using Store Morph to develop your own applications and serve as working script examples. Contact Us:Contact us page template: CONTACT.mvt The Contact Us form collects form data from the customer and sends you or your support staff their email message. By providing customers a form instead of an email address you protect yourself from spam and keep your customers on your site while they are contacting you. Using this template and the Tell a Friend templates as examples, you can create an unlimited number of data collection forms and retain full control over how they are processed and delivered. Featured Products:Featured Products page template FEATURED.mvt This page template displays selected products on the Storefront page or any other page you desire in a three column format. It does this by using a special category called Featured Products. Using a category makes managing the display user friendly, simply add or remove products from the category. Mini Basket:Mimi basket template: MINI.mvt Use the Screen item to embed this template in your global header or on certain pages. Random Products:Random Product template: RAND__v.mvt This template displays randomly selected products vertically. Products can be selected from all products or from certain categories. Tell a Friend:Tell a Friend consists of two page templates; TELL.mvt and TELLSEND.mvt The page template (TELL.mvt) collects form data from the customer for up to three recipients and sends them an email link to a particular product or page. The second template TELLSEND.mvt validates and processes the form data then sends the email. By studying how the program processes the TELL form in TELLSEND, you can create your own scripts for an unlimited number of data collection forms and retain full control over how the forms are processed and delivered. MivaScriptMivaScript TM is the web language that Miva Merchant TM is written in. MivaScript programs are HTML documents that also contain tags (commands) from the MivaScript programming language. It is a powerful server-side scripting language that is implemented by the Miva Merchant Virtual Machine Empressa TM, rather than by the browser. More information can be found here:
Writing Modules:The point of Toolbelt is that you don't need a module for everything, especially if you just want to manipulate the data or screens, after all it's your store. Examine the included Tell A Friend template closely and you will see what I mean. If you really want to write a module start with these:
Writing Functions:Writing MivaScript functions is far simpler than writing modules. You can write an external function, compile and upload it, then use the Do item in Toolbelt to call the function from your page template. Obviously, a single file can contain many functions so you can build your own library. That is exactly how Toolbelt started. Here is the piece of code from Toolbelt that implements the Compress() function. <MvFUNCTION NAME="Compress" PARAMETERS="string" STANDARDOUTPUTLEVEL="">
<MvCOMMENT> Removes all whitespace from string </MvCOMMENT>
< MvASSIGN NAME="l.newval" VALUE="{ l.string $ asciichar(10) $ '<eof>' }">
< MvASSIGN NAME="l.retval" VALUE="">
< MvASSIGN NAME="l.linenum" VALUE="{ l.linenum + 1 }">
< MvASSIGN NAME="l.line" VALUE="{ gettoken(l.newval,asciichar(10),l.linenum) }">
<MvWHILE EXPR="{ l.line NE '<eof>' }">
<MvASSIGN NAME="l.line" VALUE="{
glosub(glosub(l.line,asciichar(9),' '),asciichar(13),'') }">
<MvASSIGN NAME="l.line" VALUE="{ trim(l.line) }">
<MvIF EXPR="{ l.line }">
<MvASSIGN NAME="l.retval" VALUE="{ l.retval $ l.line $ asciichar(10) }">
</MvIF>
<MvASSIGN NAME="l.linenum" VALUE="{ l.linenum + 1 }">
<MvASSIGN NAME="l.line" VALUE="{ gettoken(l.newval,asciichar(10),l.linenum) }">
</MvWHILE>
<MvASSIGN NAME="l.newval" VALUE="">
<MvFUNCRETURN VALUE="{ l.retval }">
</MvFUNCTION>
Once compiled and can it could be called like this from your page template. <mvt:item name="ry_toolbelt" param="do
|'/mm5/compress.mvc'|g.result|Compress(g.textstring)" />
The easiest way to learn, is to view scripts written by other people. Start by searching Google for MivaScript Tags. Credits and CopyrightsParts of this document are excerpts from the Miva Merchant 5 Documentation and MivaScript Guide 4.0x. They and reproduced here with the permission of Miva Merchant. PCI Net is a trade mark of Andreas Toman. Miva Merchant, Store Morph, MivaScript, MivaScript compiler are trademarks of Miva Merchant. The PCI Net Toolbelt module is copy written 2009 by Ray Yates. I want to personally thank Andreas Toman for getting me back into Miva and being a friend and Daren Ehlers
for getting me hooked on scripting in Merchant 4 to begin with. |
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||