We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 5532
    • 251 Posts
    Thanks for that - the search term is highlighted but there isn’t much surrounding text and some of the results don’t have any surrounding text.
      • 12941
      • 87 Posts
      I’m also trying to use this snippet with the non-Ajax. I am feeling a little stupid because I can’t seem to get this to work properly. I have my search form located in the header, and if I leave

      [+as.showResults:is=`1`:then=`
      [+as.results+]
      


      in the layout.tpl.html file, then it shows all of my results in the header, thus breaking the layout AND in the body of the page I have created for the search results to display. If I remove that bit of code in layout.tpl.html then the results are removed in both spots. Maybe this is because the search form is being displayed twice on the page, the code in the header (which is part of my template) and the code in the content area of the post? Logic tells me that I need to attach the results template to the snippet included in the content of my search page, but I can’t seem to figure out how to do that using the uploaded files vs. chunks. I’d prefer to keep it that way instead of moving them all to chunks if possible.

      [!AjaxSearch? &ajaxSearch=`0` &AS_showForm=`0` &grabMax=`20` &tplResult=`'@FILE:'assets/snippets/ajaxSearch/templates/result.tpl.html` !]
      


      I’ve also tried several other configurations with tick marks and single quotes, etc. I’ve looked at the Wiki page and copied directly what they have and nothing works.

      // Off topic rant // One thing that is kind of frustrating about ModX is that the steps on how to use these things is not really very clearly outlined. I would consider myself pretty "together" when it comes to these sorts of things. It took me about 3 hours just to figure out how to use Ditto. Once I figured it out, it’s wonderful... but I had to find most of my help off ModX’s Wiki & forums in order to make use of it.
        • 5811
        • 1,717 Posts
        I have my search form located in the header ... in the layout.tpl.html file, then it shows all of my results in the header
        Adds &AS_showResults=`0` to avoid the displaying of results with the ajaxSearch snippet call located in the header.

        Then add a second ajaxSearch snippet call inside a "landing" page to display the results (adds &AS_showForm=`0` to avoid the form).

        More information on the ajaxSearch demo site and the wiki inside my signature.