We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 11713
    • 11 Posts
    Hello,

    i use this code,

    [[Ditto?parents=`[*id*]`&depth=`2`&tpl=`chunk_ad`&where=`template=10`&sort_by=`pub_date`&summarize=`5`&paginate=`1`&paginateAlwaysShowLinks=`1`]]

    i want to select documents witch template equal to 10
    but i have this error :

    MODx encountered the following error while attempting to parse the requested resource:
    « Execution of a query to the database failed - Unknown column ’sc.templat’ in ’where clause’ »
    SQL: SELECT DISTINCT sc.id,sc.published,sc.createdon FROM `clefdune_cdw`.`modx_site_content` sc LEFT JOIN `clefdune_cdw`.`modx_document_groups` dg on dg.document = sc.id WHERE sc.id IN (12,13,14,16) AND sc.published=1 AND sc.deleted=0 AND sc.templat AND (sc.privateweb=0) GROUP BY sc.id ORDER BY sc.createdon DESC
    [Copy SQL to ClipBoard]


    when i make &where="template>10" it works but &where=`template=10` no

    if some one have a solution ?

    Hamza
      • 28042 ☆ A M B ☆
      • 24,524 Posts
      Can’t have ? & = in parameter values. The snippet processor thinks it’s another parameter=value element.
        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
        • 1788
        • 1,103 Posts
        &where=`sc.templat=10`
          • 28042 ☆ A M B ☆
          • 24,524 Posts
          Probably the best way to deal with this would be to use an external config file. Your Ditto snippet would only have one parameter, &config=`filename`. Then in the assets/snippets/ditto/configs folder, create a new file "filename.config.php" and put the parameters there as ordinary PHP $paramname = ’value’; variable definition lines. You can have all the & ? = characters you want.
            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
            • 7142
            • 1 Posts
            I solved the same problem.
            Double `e` in `template`
            For example:
            [[Ditto?parents=`[*id*]`&depth=`2`&tpl=`chunk_ad`&where=`templatee=10`&sort_by=`pub_date`&summarize=`5`&paginate=`1`&paginateAlwaysShowLinks=`1`]]