We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 12028
    • 152 Posts
    Maybe it’s a stupid question, but are there a possibility to exclude specific templates in a search?

    I’ve tried this:
    [!AjaxSearch? &filter=`template,6,2` &AS_showForm=`0` &ajaxSearch=`0` &addJscript=`0`!]

    in Evo 1.01 and AS 1.8.3a, but with no luck.

    What I want is that every ressource with the template id = 6 are removed from the results. I know that I just can unmark the searchable checkbox in the Page Settings (Shouldn’t it be Resource settings by the way?) but not on 800 resources... wink

    Had I missed something?

      - A small step for mankind, so why not take two...

      Working with web production, graphic design/workflow, photo and education - but are trying to get a life in between!
      • 28042 ☆ A M B ☆
      • 24,524 Posts
      Try the DocManager module (Modules -> DocManager); it lets you set that and other setting in bulk in the "Other Properties" tab. Select "Searchable/Unsearchable" from the Available Settings select drop-down, and the Unsearchable radio button. Then in the field below, put in the document IDs you want. You can use ranges (46-68, for example), specify a document and its children, and individual documents all on the same line, each grouping separated by a comma.

      You might find it easier, however, to use your domain’s MySQL client (phpMyAdmin?) and run a simple query
      UPDATE modx_site_content SET cacheable=0 WHERE template IN (6,2)
        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
        • 12028
        • 152 Posts
        Quote from: sottwell at Aug 17, 2009, 03:13 PM


        You might find it easier, however, to use your domain’s MySQL client (phpMyAdmin?) and run a simple query
        UPDATE modx_site_content SET cacheable=0 WHERE template IN (6,2)


        Thanks sottwell,

        I try the query, the solution in the DocManager will be just as time-consuming as editing one ressource at a time. And that is the biggest problem: The customer is not very structured in the website and that - in the long run - it would be better to filter the templates.
          - A small step for mankind, so why not take two...

          Working with web production, graphic design/workflow, photo and education - but are trying to get a life in between!
          • 28042 ☆ A M B ☆
          • 24,524 Posts
          If this is going to be an ongoing issue, you might want to make a plugin to work with the OnDocFormSave event and check the template and update the database if necessary.
          $modx->db->query('UPDATE ' . $modx->getFullTableName('site_content') . ' SET cacheable=0 WHERE id= ' . $id . ' AND template IN (6,2)');

            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
            • 5811
            • 1,717 Posts
            &filter=`template,6,2`
            should work. Have you set this parameter in the two ajaxSearch snippet calls (on the page with the search input) and on the page with results ?
              • 28042 ☆ A M B ☆
              • 24,524 Posts
              That would make everything a lot easier, that’s for sure!
                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
                • 12028
                • 152 Posts
                @sottwell: The plugin OnDocFormSave is a good suggestion - it can be very useful!!!! Thanks again!!!

                @coroico:

                I have this on the page with the search form:
                [!AjaxSearch? &ajaxSearch=`0` &filter=`template,6,2` &AS_landing=`66` &moreResultsPage=`8` &showMoreResults=`1` &addJscript=`0` &extract=`0` &AS_showResults=`0`!]


                And this on the resultspage:
                [!AjaxSearch? &filter=`template,6,2` &AS_showForm=`0` &ajaxSearch=`0` &addJscript=`0`!]
                  - A small step for mankind, so why not take two...

                  Working with web production, graphic design/workflow, photo and education - but are trying to get a life in between!