Announcement

Collapse
No announcement yet.

Miva SMT snippet to display data for debugging

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Miva SMT snippet to display data for debugging

    Just thought I'd share this snippet of SMT code. It's a quick and easy way to debug data, such as l.settings:products (or whatever data you want), on the page. It's not new or anything, but clients I've shared it with have found it to be a good time saver.

    First it checks to see if "debug" is turned on so no one but you sees it.

    Then it serializes the data (turns into a more "readable" format (if we're lucky)) and puts in line breaks for easy reading.

    Put this code snippet in the page template where you want to see the data:

    Code:
    <mvt:if expr="g.__debug EQ 1">
         <mvt:eval expr="glosub(miva_array_serialize(l.settings:products),',','<br>'))" />
    </mvt:if>
    The g.__debug part keeps it hidden from anyone but you. To see the debug info add one of the following to the end of the url.

    If it's a .HTML url: ?__debug=1

    If it's a URL with data and there's already a ? symbol: &__debug=1
    M.A.D.* since 1997

    http://www.scotsscripts.com

    *miva application developers
Working...
X