Scot's Scripts Miva Merchant Module Support

Scot's Scripts Miva Merchant Module Support

Support for our Miva Modules.
Find answers to your installation and usage questions.
This is the place to start if you have questions about our modules. Most of our Miva Modules are fully documented. Do not hesitate to contact us if you can't find the answer you're looking for!

Looking for something? Start typing here:

Scot's Blogger is used to created this support system.

Scots Blogger Template Snippets and Explanations

The main code blocks from the blog template without CSS.
last updated

The code blocks below are the ones used in the stock templates for Scot's Blogger. If you have altered your template and need to go back, or if you are looking for a way to do something, these will help.


The code blocks and explanations below are for version 3.1 of Scot's Blogger and CMS and although many of the examples will work in earlier versions, there are some things that will not unless you are using version 3.1 or higher.

Efforts have been made to strip CSS and other framework related tags from the code but at this time there may be some stray styling code in the snippets. Note that in some cases, the style tags are there for a reason, such as to highlight when you're previewing a draft instead of viewing a published article.

Important Global Variables

g.scotsblogger_postid is set by the slug, the URL, of the post. It is used throughout the stock template to load data and check mvt:if statements/conditionals for various reasons.

g.scotsblogger_offset is a variable that deals with pagination. Whatever this is set to is the current page.

g.blog_id

For loading post lists and doing many other things as of v3 the system needs g.blog_id in the environment. Normally this is set automatically so you don't need to worry about it, however if you want to load a global blog post sidebar or add recent posts to your global footer, or some such thing, then you'll need to set g.blog_id manually. You can get the blog id number from the blog list in the module admin.

<mvt:assign name="g.blog_id" value="1" />

The other thing you can do is add the scotsblogger page item above the code snippet to automatically try to set the blog id and other environment variables:

<mvt:item name="scotsblogger" />

Messages

Messages are used for the most part when dealing with comments.

Success messages are in g.scotsblogger_success

Error messages are in g.scotsblogger_error

<mvt:if expr="g.scotsblogger_success">
    <div>&mvte:global:scotsblogger_success;</div>
</mvt:if>

<mvt:if expr="g.scotsblogger_error"> <div>&mvte:global:scotsblogger_error;</div> </mvt:if>

Search Results

The search term variable is g._scotsblogger_search and is the name of the search form imput. The results array after a search is found in l.settings:scotsblogger:searchresults

Blog Header

The blog header will either be based on the blog SEO information (blog settings) or the category SEO information if a category is selected. 

The code below is a conditional that will figure this out and display the proper information. The first section will display category info, the second section will display general blog info.

<mvt:if expr="l.settings:scotsblogger:currentcategory">
    <h2><a href="&mvt:scotsblogger:currentcategory:url;">&mvt:scotsblogger:currentcategory:name;</a></h2>
    <mvt:if expr="l.settings:scotsblogger:currentcategory:featured_image">
        <p>
            <img src="&mvt:scotsblogger:currentcategory:featured_image;" alt="&mvt:scotsblogger:currentcategory:name;">
        </p>
    </mvt:if>
    <mvt:if expr="l.settings:scotsblogger:currentcategory:descrip">
        <p>
            &mvt:scotsblogger:currentcategory:descrip;
        </p>
    </mvt:if>
    <hr>
<mvt:else>
    <mvt:if expr="g.scotsblogger_description">
        <p>
            &mvte:global:scotsblogger_description;
        </p>
    </mvt:if>
    <mvt:if expr="g.scotsblogger_featured_image">
        <p>
            <img src="&mvte:global:scotsblogger_featured_image;" alt="&mvte:page:name;">
        </p>
    </mvt:if>
</mvt:if>

Post List/Array

This block of code is very important to the template and will load the l.settings:scotsblogger:posts array with any group of posts. This includes archives, search results, category posts, most recent posts, and others.

Each of the conditions below will load a different set of posts into the array by calling functions from the moduel, as well as output a header such as Recent Posts or Search Results. The l.settings:scotsblogger:total_posts variable is set automatically (it's a var style variable in the messages_load_recent function.) The total posts variable is used to figure out pagination in the template.

<mvt:if expr="l.settings:scotsblogger:searchresults">
    <h3 class="aligncenter">Search Results</h3>
    <mvt:assign name="l.settings:scotsblogger:posts" value="l.settings:scotsblogger:searchresults">
    <mvt:assign name="l.settings:scotsblogger:searchresults" value="''">
<mvt:elseif expr="g.scotsblogger_archives EQ 'more'">
    <mvt:do file="g.smr_libpath $ 'totals.mvc'" name="l.settings:scotsblogger:archives" value="get_total_type_token('archive')">
    <h3 class="text-center">Archives</h3>
    <p>
        <mvt:foreach iterator="archive" array="scotsblogger:archives">
            <mvt:do file="g.scotsblogger_main" name="l.settings:scotsblogger:archive_time" value="display_date(l.settings:archive:token,13)">
            <a href="<mvt:eval expr=" g.scotsblogger_baseurl="" $="" l.settings:scotsblogger:archive_time:year="" '="" l.settings:scotsblogger:archive_time:month="" '"="">">, </a>
        </mvt:foreach>
    </p>
<mvt:elseif expr="g.scotsblogger_archives EQ 'all'">
    <mvt:do file="g.smr_libpath $ 'bloggums.mvc'" name="l.settings:scotsblogger:posts" value="messages_load_recent(g.scotsblogger_defaultarticles,'','p',1,l.settings:scotsblogger:total_posts)">
    <h3 class="aligncenter">Archives</h3>
<mvt:elseif expr="NOT ISNULL g.scotsblogger_archive_year AND NOT ISNULL g.scotsblogger_archive_month">
    <h3 class="aligncenter">Archives for , </h3>
    <mvt:do file="g.smr_libpath $ 'bloggums.mvc'" name="l.settings:scotsblogger:posts" value="message_load_archive(g.scotsblogger_archive_year,g.scotsblogger_archive_month,l.settings:archive_total)">
<mvt:elseif expr="NOT ISNULL g.scotsblogger_category_code">
    <mvt:do file="g.smr_libpath $ 'bloggums.mvc'" name="l.settings:scotsblogger:posts" value="load_category_posts(g.scotsblogger_category_code,'','published',g.scotsblogger_offset,l.settings:scotsblogger:total_posts)">
    <h3 class="aligncenter">Recent Posts</h3>
<mvt:else>
    <mvt:do file="g.smr_libpath $ 'bloggums.mvc'" name="l.settings:scotsblogger:posts" value="messages_load_recent(g.scotsblogger_defaultarticles,'','p',1,l.settings:scotsblogger:total_posts)">
    <h3 class="aligncenter">Recent Posts</h3>
</mvt:if>

The Post Loop

If you're a fan of Wordpress you have probably heard of "the loop" which basically displays the blog roll. Same thing here. We take the l.settings:scotsblogger:posts array and display the data.

<mvt:foreach iterator="post" array="scotsblogger:posts">
    <article itemprop="blogPost" itemscope="" itemtype="http://schema.org/BlogPosting">
    <h4>
    <mvt:if expr="l.settings:post:sticky">
        <b>(sticky)</b>
    </mvt:if>
    <a href="&mvt:post:url;"><span itemprop="headline">&mvt:post:title;</span></a>
    </h4>

<mvt:if expr="l.settings:post:subtitle"> <h5>&mvt:post:subtitle;</h5> </mvt:if>
<mvt:if expr="l.settings:post:featured_video:iframe"> <div itemprop="video" itemscope="" itemtype="http://schema.org/VideoObject"> &mvt:post:featured_video:iframe; <meta itemprop="url" content="&mvt:post:featured_video:url;"> <meta itemprop="description" content="&mvt:post:synopsis;"> <meta itemprop="name" content="&mvt:post:title;"> <meta itemprop="thumbnailUrl" content="&mvt:post:featured_video:url;"> <meta itemprop="uploadDate" content="&mvt:post:publishparsed:year;-&mvt:post:publishparsed:month;-&mvt:post:publishparsed:day;"> </div> <mvt:elseif expr="l.settings:post:image:src"> <div itemprop="image" itemscope="" itemtype="https://schema.org/ImageObject"> <a href="&mvt:post:url;"><img src="&mvt:post:image:src;" alt="&mvt:post:image:alt;" title="&mvt:post:image:title;"></a> <meta itemprop="url" content="&mvt:global:domain:base_url;&mvt:post:image:src;"> </div> </mvt:if>
<mvt:if expr="l.settings:post:synopsis"> <p><i itemprop="description">&mvt:post:synopsis;</i></p> </mvt:if>
<mvt:if expr="l.settings:post:header"> <p itemprop="text">&mvt:post:header;</p> </mvt:if>
<p> <span itemprop="author" itemscope itemtype="https:schema.org/person"><i itemprop="name">&mvt:post:penname;</i></span>, <i>&mvt:post:publishparsed:month_str; &mvt:post:publishparsed:day;, &mvt:post:publishparsed:year;</i> <meta itemprop="datePublished" content="&mvt:post:publishparsed:year;-&mvt:post:publishparsed:month;-&mvt:post:publishparsed:day;">
<meta itemprop="dateModified" content="&mvt:post:publishparsed:year;-&mvt:post:publishparsed:month;-&mvt:post:publishparsed:day;"> </p>
<mvt:if expr="g.scotsblogger_md_publisher"> <div itemprop="publisher" itemscope="" itemtype="https://schema.org/Organization"> <meta itemprop="name" content="&mvt:global:scotsblogger_md_publisher;"> <mvt:if expr="l.settings:readytheme:logo_type EQ 'image'"> <div itemprop="logo" itemscope itemtype="https://schema.org/ImageObject"> <meta itemprop="url" content="http://&mvt:global:domain:name;&mvte:readytheme:logo_image;"> </div> </mvt:if> </div> </mvt:if> <hr> </article> </mvt:foreach>

Tags

The tags are in the post data in the variable l.settings:scotsblogger:currentpost:taglist

Tag searches are similar to the blog search apart from the way the search term is used and it's a link, not a form. To make a tag search, just add tag: to the front of any search term, such as, "tag:dogs"

<mvt:if expr="l.settings:scotsblogger:currentpost:taglist">
    <p>
    <mvt:foreach iterator="tag" array="scotsblogger:currentpost:taglist">
        <a class="button" href="&mvt:global:scotsblogger_search_url;?_scotsblogger_search=tag:&mvte:tag;">&mvt:tag;</a>
    </mvt:foreach>
    </p>
</mvt:if>

Pagination

I'm not putting the pagination code in here because it's not something most people will use on it's own. Please see the pagination area of your template (or in one of the templates from the installation guide) for details.

Display a Post

To display a post all you need to do is load the post using the function call below and then display the data in any way you like.

<mvt:do file="g.smr_libpath $ 'bloggums.mvc'" name="l.ok" value="runtime_message_load_id(g.scotsblogger_postid,l.settings:scotsblogger:currentpost)" />

The first part of the post handles featured image/video meta data and you can look at the template for that. The code below displays the basic post information similar to how it's set up in the templates including the header with the category list and author/published info.

<a href="&mvt:scotsblogger:currentpost:url;"
<mvt:if expr="l.settings:scotsblogger:currentpost:subtitle">
    <p class="scotsblogger-subtitle" itemprop="about">&mvt:scotsblogger:currentpost:subtitle;</p>
</mvt:if>

<mvt:if expr="l.settings:scotsblogger:currentpost:synopsis"> <hr> <p class="scotsblogger-synopsis" itemprop="description">&mvt:scotsblogger:currentpost:synopsis;</p> </mvt:if>
<mvt:if expr="l.settings:scotsblogger:currentpost:publish_t"> <p itemprop="datePublished" datetime="&mvt:scotsblogger:currentpost:publishedMetadata;"> by <span itemprop="author">&mvt:scotsblogger:currentpost:penname;</span> • &mvt:scotsblogger:currentpost:publishparsed:month_str; &mvt:scotsblogger:currentpost:publishparsed:day;, &mvt:scotsblogger:currentpost:publishparsed:year; <meta itemprop="dateModified" content="&mvt:scotsblogger:currentpost:publishedMetadata;"> </p> <mvt:else> <p style="background-color:#ffc760; padding:5px; border-radius: 5px;"> <b>draft:</b> by <span itemprop="author">&mvt:scotsblogger:currentpost:penname;</span> • <i>last updated: &mvt:scotsblogger:currentpost:updatedparsed:month_str; &mvt:scotsblogger:currentpost:updatedparsed:day;, &mvt:scotsblogger:currentpost:updatedparsed:year;</i> </p> </mvt:if>
<mvt:if expr="l.settings:scotsblogger:currentpost:categories"> <p> <mvt:foreach iterator="cat" array="scotsblogger:currentpost:categories"> <mvt:if expr="NOT ISNULL l.settings:scotsblogger:currentpost:categories[l.pos1 + 1]:name"> <a href="&mvt:cat:url;"><i>&mvt:cat:name;</i></a>, <mvt:else> <a href="&mvt:cat:url;"><i>&mvt:cat:name;</i></a> </mvt:if> </mvt:foreach> </p> </mvt:if>
<hr>
<div id="scotsblogger-post" itemprop="articleBody"> &mvt:scotsblogger:currentpost:rendered;
<mvt:if expr="l.settings:scotsblogger:currentpost:related_list"> <h3>Related Posts and Information</h3> <mvt:foreach iterator="link" array="scotsblogger:currentpost:related_list"> <p> <a href="&mvt:link:url;">&mvt:link:title;</a> <mvt:if expr="l.settings:link:image"> <a href="&mvt:link:url;"><img src="&mvt:link:image;"></a> </mvt:if> </p> </mvt:foreach> </mvt:if> </div>

Ratings

If you have a post loaded using the 

<mvt:do file="g.smr_libpath $ 'bloggums.mvc'" name="l.ok" value="runtime_message_load_id(g.scotsblogger_postid,l.settings:scotsblogger:currentpost)"/>

function then the ratings data will be loaded with the post data in l.settings:scotsblogger:currentpost and can be used in the following way. Please note that you will need to load the scotsblogger head and foot page items for the required CSS and javascript needed to make the default star ratings work.

<mvt:if expr="g.scotsblogger_ratings_global_off NE 1">
    <hr>
    <div id="ratings" itemprop="aggregateRating" itemscope itemtype="http://schema.org/AggregateRating">
    <div id="response"></div>
    <meta itemprop="ratingValue" content="<mvt:eval expr="l.settings:scotsblogger:currentpost:rating:rating round 0" />
    <meta itemprop="reviewCount" content="&mvt:scotsblogger:currentpost:rating:votes;">
    <span style="position: relative; top: -6px;">overall rating:</span>
    <div class="rateit" style="font-size: 1.5em;" data-rateit-value="&mvt:scotsblogger:currentpost:rating:rating;" data-rateit-ispreset="true" data-rateit-readonly="true" data-rateit-mode="font"></div>
    <span style="position: relative; top: -6px;">my rating:</span>
    <mvt:if expr="g.customer:id">
        <div class="rateit" style="font-size: 1.5em;" id="scotsbloggermyrating" data-rateit-resetable="false" data-rateit-step="1" data-ratingstype="b" data-ratingspostid="&mvt:scotsblogger:currentpost:id;" data-rateit-mode="font" data-rateit-value="&mvt:scotsblogger:currentpost:myrating:rating;"></div>
    <mvt:else>
        <span style="position: relative; top: -6px;"><i>log in to rate</i></span>
    </mvt:if>
    </div>
</mvt:if>

Comments

Please see the template for the code blocks referring to comments. Please contact support if you need help with customizing comments.

Search Form

The search form is fairly basic. The system will populate search results if g._scotsblogger_search has one or more search terms.

<form method="post" action="https://www.scotsscripts.com/support/search.html">
    <input name="_scotsblogger_search" type="text" placeholder="Search for..." value="&mvte:global:scotsblogger_search;">
    <button type="submit">Go</button>
</form>

Load Recent Posts Lists

The recent posts loop below requires that g.blog_id be set. 

Normally this would be set automatically based on the URL and htaccess settings, however if you want to load the post data into another page, or in a global sidebar or some such thing, you will need to set the blog id manually. You can find the blog id from the blog list in the module admin.

You set the blog id like this (if you wanted to set it to 1):

<mvt:assign name="g.blog_id" value="1" />

The recent posts loop starts with setting g.scotsblogger_nooffset to 1 so that if the global offset variable for pagination has been set we can still get the first set of posts. Otherwise we'd load posts from wherever the pagination is set to start.

<mvt:assign name="g.scotsblogger_nooffset" value="1" />
<mvt:if expr="miva_array_elements(l.settings:scotsblogger:posts) LT 1 AND g.scotsblogger_offset LE 0">
    <mvt:do file="g.smr_libpath $ 'bloggums.mvc'" name="l.settings:scotsblogger:posts" value="messages_load_recent(g.scotsblogger_defaultarticles,l.null,'p',1,l.settings:scotsblogger:total_posts)" />
</mvt:if>
<h4>Recent Posts</h4>
<p>
<mvt:foreach iterator="post" array="scotsblogger:posts">
    <mvt:if expr="(NOT g.scotsblogger_category_code OR (g.scotsblogger_category_code AND (l.settings:post:catcode NE g.scotsblogger_category_code)))">
        <a href="&mvt:post:url;">
        <mvt:if expr="l.settings:scotsblogger:currentpost:id EQ l.settings:post:id AND g.scotsbloger_postid">
            <b>&mvt:post:title;</b>
        <mvt:else>
            &mvt:post:title;
        </mvt:if>
        </a>
    </mvt:if>
</mvt:foreach>
</p>

Recent Category Posts 

Also requires g.blog_id to be set (see load recent posts above.)

<mvt:if expr="NOT ISNULL g.scotsblogger_category_code">
<mvt:do file="g.smr_libpath $ 'bloggums.mvc'" name="l.settings:scotsblogger:categoryposts" value="load_category_posts(g.scotsblogger_category_code,'','published',0,l.null)" />
<mvt:if expr="l.settings:scotsblogger:categoryposts">
    <h4>&mvt:scotsblogger:currentcategory:name;</h4>
    <p>
    <mvt:foreach iterator="post" array="scotsblogger:categoryposts">
        <div>
        <mvt:if expr="l.settings:post:caturl">
            <a href="&mvt:post:caturl;">
        <mvt:else>
            <a href="&mvt:post:url;">
        </mvt:if>
        <mvt:if expr="l.settings:scotsblogger:currentpost:id EQ l.settings:post:id">
            <b>&mvt:post:title;</b>
        <mvt:else>
             &mvt:post:title;
        </mvt:if>
        </a>
        </div>
    </mvt:foreach>
    </p>
</mvt:if>
</mvt:if>

Category List

This also requires the g.blog_id var to be set (see above.)

<mvt:do file="g.smr_libpath $ 'cats.mvc'" name="l.settings:scotsblogger:categories" value="get_blog_cat_list()" />
<mvt:if expr="l.settings:scotsblogger:categories">
    <h4>Categories</h4>
    <p>
    <mvt:foreach iterator="category" array="scotsblogger:categories">
        <mvt:if expr="l.settings:category:totalposts GT 0">
            <div>
            <a href="&mvt:category:url;">&mvt:category:name;</a>
            </div>
        </mvt:if>
    </mvt:foreach>
    <a href="&mvt:global:scotsblogger_blog:slug_url;">all...</a>
    </p>
</mvt:if>

Archives

Please check the template for the archives sidebar code

Feed URL

<mvt:if expr="NOT ISNULL g.scotsblogger_feedurl">
    <p>
    <a href="/&mvte:global:scotsblogger_feedurl;" title="Scot's Scripts RSS Feed">RSS</a>
    </p>
</mvt:if>

If you need more information or examples of anything please contact support and we'll do what we can to help.