We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 10194
    • 16 Posts
    I’m currently trying to pass a TV to a snippet and it’s giving me great grief.

    Here is the snippet being passed (which I’ve tried within the content and a custom template)

    [[operationListing? &category2id=`[*cat2id*]` &catTitle=`[*alias*]` &catName=`[!getCat2Name? &category2id=`[*cat2id*]`!]`]]

    the ’cat2id’ is the TV that essentially is just a number (ie. 18)

    I’ve tried alternating the caching and uncaching of the snippet within the snippet and vice versa to no avail.

    It ends up ’spitting’ out part of the snippet (I assume it’s not parsing the code after a certain point.

    Can anyone offer some advice?
      • 10194
      • 16 Posts
      Any ideas on this?

      it’s very strange how it works if I ’hard code’ the number directly in, but if I try to pass it via the TV it bombs out.... is there a trick to template variables and snippets?
        • 22303 MODX Staff
        • 10,725 Posts
        Quote from: Fritz at Mar 02, 2009, 03:00 PM

        Any ideas on this?

        it’s very strange how it works if I ’hard code’ the number directly in, but if I try to pass it via the TV it bombs out.... is there a trick to template variables and snippets?
        Yes, unfortunately the 0.9.x releases have a very precise parsing order for different tags where all tags of a single type, i.e. [[]], [**], {{}}, [++], etc., are evaluated all at once in each pass. See this wiki article for more information on the current parser execution order.

        To get around this, you can call the snippet using the non-cacheable tags, i.e. [! !], which will delay the parsing of the snippet until after the content tags, i.e. [* *], have been processed.

        In the upcoming MODx 2.0 release, which we call Revolution, there is a more natural, source-order parsing algorithm that will allow nested tags to be evaluated as part of the evaluation of the tag it is nested in.
          • 10194
          • 16 Posts
          Thanks for the response Jason. I’ve tried the method you described above with no avail...

          [!operationListing? &category2id=`[*cat2id*]` &catTitle=`[*alias*]` &catName=`[[getCat2Name? &category2id=`[*cat2id*]`]]`!]

          just spits out the TV variable name in my query. (ie. WHERE category2id = [*cat2id*])

          If I alternate to cached from uncached [!!] [[]]

          [[operationListing? &category2id=`[*cat2id*]` &catTitle=`[*alias*]` &catName=`[!getCat2Name? &category2id=`[*cat2id*]`!]`]]

          it gets a little closer, but still no go...it trails the backticks and closing brackets to the end of the variable...

          variable $category2id spits out 18`]]

          I’m assuming I’m missing something....

          Regards,

          - Brad