Template Structure in Miva 5.5

Miva Merchant 5.5 Templates follow a standard structure for the browser to display. If you're familiar with the structure of HTML pages then you know that the core elements required for the page are:

<HTML>

<HEAD>…..</HEAD>

<BODY>

……

</BODY>

</HTML>

If you pull up your store on the front end and opt to view the source code (normally under the View Menu…choose source or page source) you'll see that any page of your store includes these elements.

These are HTML standards.

The Template structure looks a bit different, but when it's processed by the Virtual Machine (which is what makes Miva Script work on the server) then what's sent to the browser will just like that above.

Entities

If you're a convert from Miva Merchant 4 and third-party template modules then you're familiar with tokens—snippets of code that tell Miva Merchant to "put this… right here." Miva Merchant 5 uses calls these "tokens" Entities.

If you've ever used a word processing program to create a mail merge, you'll have a better understanding about Entities. For example, you can create a spreadsheet of names and addresses with Microsoft Excel, and write a form letter in Microsoft Word. Then you can personalize the letter for hundreds of people simply by telling Microsoft Word to insert the recipient's first and last name in the salutation and to print 300 letters, all personalized.

Entities look different, though. They start with an ampersand (&) and end with a semicolon ( ; ), with parts separated by a colon ( : ). To display the store name on the screen you would use:

&mvt:store:name;

There are three parts to an Entity. In the one above, the &mvt denotes this is a Miva template entity. The store denotes what part of the store interface is being referenced. The name depicts what specifically should be called into the template.

But, why would I use an Entity to display the name of my store? Good question; and the answer is simple. Let's say in a year you decide to change the name of the store. If you typed the store name in manually, you'd need to go through all the Admin and make changes to every reference. If you use an Entity, you won't have to do a thing. Once you update the name in the Admin, the new name will be used anywhere you called it with an Entity.

However, it is understood that some online stores use a different name for the Title Tag purposes, then manually enter the actual Store Name throughout the templates. But… there's an easier way by simply editing the title tag (read on).

Items

An item is an actual collection of information. It's similar to the HTML font tag:

<font face="Arial, Helvetica" color="red" size="2">

This tells the browser to display the text in the typeface of Arial, with Helvetica as a second option, in the color of red and at a size of 2.

While you could use the actual font tag in the template, the benefit of using an Item is that if you change the font settings for the store, they will automatically be changed everywhere you place the Item. For example, <mvt:item name="fonts" param="body_font"> calls the parameters you have set for the store's body font (you set this up under your store's settings).

Of course, if you plan to use CSS to control all fonts and font styles, you wouldn't use this particular item at all.

An Item can also call in an entire component of the store. To display the navigation bar on the screen we use <mvt:item name="navbar" />.

Working with Templates

To work with a Page Template, you click the Pages link in the Admin Menu, locate the page you want to modify and click its Edit button.

The templates can include text, HTML and other compatible script functions (like JavaScript). We can use Item tags and Entities to reference and call in information.