We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 36467
    • 73 Posts
    I got task to edit the existing code (which is written by someone else), Code lists posts according to the "postcategory" variable in query string. Code uses getPost and getResources along with TV.
    Question is when i open this url www.website.com/category-post-updates?postcategory=string1 it works but when i try to open category-post-updates?postcategory=some _other_string, it doesnt list anything.

    Below is the code for tvFilter
    &tvFilters=`[b]post_category[/b]==%[[!get.querystring? &name=`postcategory`]]%,post_subcategory==%[[!get.querystring? &name=`postsubcategory`]]%`
    


    Below are the TV Details

    Name : post_category
    Caption : Categories
    Input Type: Checkbox
    Input Option Values: @select listlabel, listvalue from modx_listvalues where listkey='postcategory' order by weight asc, listlabel asc, id asc

    1) How can i debug whats happening in background ? I mean how/where can i print/see the query that run behind this code ?
    2) What is @ in query ? Why it is used ? @select listlabel
      • 28042 ☆ A M B ☆
      • 24,524 Posts
      I can answer #2. The @ symbol used with TVs indicates a source binding; @SELECT means that the source will be a SELECT query to the database. If you look at the rest of the @SELECT line, you can see that it's just a basic SQL select query.
        Studying MODX in the desert - http://sottwell.com
        Tips and Tricks from the MODX Forums and Slack Channels - http://modxcookbook.com
        Join the Slack Community - http://modx.org
        • 22840
        • 1,572 Posts
        For 1 if you remove the below from the call it should print everything it's doing

        &tpl=`templateName`
          • 36467
          • 73 Posts
          @paul : I removed the template and see that For the string which is working it prints array of information as expected, but in case of second string it prints nothing. I am not sure, it has to print atleast something ?