site_value

Loads content between webstore templates

Example

Setting the content to store:

[%site_value id:'your_id'%]
    Content goes here
[%/site_value%]

Loading stored content:

[%site_value id:'your_id' type:'load' /%]

Standard footer_javascript used in most themes:

Product template:

[%site_value id:'footer_javascript'%]
    <script type="text/javascript" language="javascript">
        $(document).ready(function() {
            $.product_variationInit({
                'loadtmplates': ['_buying_options', '_images','_header'],
                'fns' : {
                    'onLoad' : function () {
                        $('.addtocart').button("loading");
                        $('.variation-wrapper').addClass('disable-interactivity');
                    },
                    'onReady' : function () {
                        $('.addtocart').button("reset");
                        $('.zoom').zoom();
                        $('.variation-wrapper').removeClass('disable-interactivity');
                        $("#sale-end").countdown({
                            date: "[%format type:'date' format:'#K #d, #Y  #H:#I'%][@promo_end@][%/format%]"
                        });
                    },
                }
            });
            [%if [@has_components@]%]
                $.kit_variationInit({});
            [%/if%]
        });
    </script>
[%/site_value%]

Footer template:

[%site_value id:'footer_javascript' type:'load' /%]

Usage

The site value tag first selects a block of content to load which can include all sorts of HTML & B@SE tags, but then loads them in a separate part of the site and includes support for separate templates.

An example of this is within our core template is using it to load any Javascript that occurs in the body and relies on body specific data tags to be moved to the footer to assist page load.

When using the site_value tag there are 3 things to remember about it's use:

  1. The site value can only be loaded underneath the data that is collected in the code on the page.
  2. When loading setting and loading data, keyhole caching will break the results.
  3. The site value tag will not react dynamically to AJAX calls of new content but will work with static load_template blocks.
  4. The site value tag will not work across print or email templates

Parameters

Name Options Description
`id:''` String The unique ID of content you'd either like to store or load
`type:''` `load` Without type `load` specified the tag will by default set the content. When the type is set to load it will load based on the ID.
`type:''` `reset` Resets the stored value to nothing.

Was this article useful?

Be notified when this page is updated. Optional.