Announcement

Collapse
No announcement yet.

Significance of mvtj in GFTL page

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

    Significance of mvtj in GFTL page

    Hi,

    Just going through the template changes in 9.0004, and I saw a use of "mvtj" tag in GFTL page. As far, I have seen only mvt, mvte and mvta tags. Can someone explain me the use of mvtj tag there.
    Rajnish Sinha
    ---------------------
    https://twitter.com/rajnishsi

    #2
    Re: Significance of mvtj in GFTL page

    I'm going to guess that this returns the data in json format, and if so...why wasn't this highlighted...that'd be cool not to have to run data back through merchant (using MvDo) to get json formatted data...now...if we can only get rid of having to type so many ' : 's
    Bruce Golub
    Phosphor Media - "Your Success is our Business"

    Improve Your Customer Service | Get MORE Customers | Edit CSS/Javascript/HTML Easily | Make Your Site Faster | Get Indexed by Google | Free Modules | Follow Us on Facebook
    phosphormedia.com

    Comment


      #3
      Re: Significance of mvtj in GFTL page

      It uses the encodejavascriptstring builtin function which escapes all necessary characters for use with JavaScript.

      So if you have template code where you're using <script type="text/javascript"> and you have Miva tokens, you'd would want to set variables using the mvtj functionality in order to be safe.

      Hope this helps.
      David Carver
      Miva, Inc. | Software Developer

      Comment


        #4
        Re: Significance of mvtj in GFTL page

        Thanks David,

        Although all uses I can see on the new template changes use that tag for generating URLs for JS functions, but I'm assuming , based upon your explanation that it will also be valid to use that anywhere inside "<script></script>" tags on the page. Sounds nice to have something like that in SMT.

        Bruce, I'd love to have functions in SMT as well to easily convert between JSON <-> Strings and JSON <-> Structures/Arrays. Would be pretty handy.
        Rajnish Sinha
        ---------------------
        https://twitter.com/rajnishsi

        Comment


          #5
          Re: Significance of mvtj in GFTL page

          yea, i was just using wishful thinking...never tried it but you should be able to pass it through the json features using smt:mvdo.
          Bruce Golub
          Phosphor Media - "Your Success is our Business"

          Improve Your Customer Service | Get MORE Customers | Edit CSS/Javascript/HTML Easily | Make Your Site Faster | Get Indexed by Google | Free Modules | Follow Us on Facebook
          phosphormedia.com

          Comment


            #6
            Re: Significance of mvtj in GFTL page

            Originally posted by rajnishsi View Post
            Thanks David,

            Although all uses I can see on the new template changes use that tag for generating URLs for JS functions, but I'm assuming , based upon your explanation that it will also be valid to use that anywhere inside "<script></script>" tags on the page. Sounds nice to have something like that in SMT.

            Bruce, I'd love to have functions in SMT as well to easily convert between JSON <-> Strings and JSON <-> Structures/Arrays. Would be pretty handy.
            Correct you should now use mvtj in <script> tags such as:
            Code:
            <script type="text/javascript">
            var my_variable;
            
            my_variable = "&mvtj:settings:something:member;";
            
            console.log( my_variable );
            </script>
            And yes I agree it would be nice to have strings / structures / arrays to JSON, maybe one day. But we also have the miva_json_decode function which will take JSON and convert it to the appropriate Miva structures / arrays.
            David Carver
            Miva, Inc. | Software Developer

            Comment


              #7
              Re: Significance of mvtj in GFTL page

              Originally posted by dcarver View Post
              And yes I agree it would be nice to have strings / structures / arrays to JSON, maybe one day. But we also have the miva_json_decode function which will take JSON and convert it to the appropriate Miva structures / arrays.
              The miva_json_decode function is only in MivaScript Engine 5.22 and later. That said, it is very useful.
              Gordon Currie
              Phosphor Media - "Your Success is our Business"

              Improve Your Customer Service | Get MORE Customers | Edit Any Document Easily | Free Modules | Follow Us on Facebook
              phosphormedia.com

              Comment

              Working...
              X