We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 349
    • 76 Posts
    After i updated MODx to 1.0.5 my snippet call for AjaxSearch
    [[AjaxSearch? &ajaxSearch=`1` &parents=`1` &moreResultsPage=`1365` &extractLength=`50` &extractEllips=`...` &showMoreResults=`1` &debug=`0` &extract=`1:content,pagetitle` &addJscript=`0` &liveSearch=`1` &jscript=`jquery` &advSearch=`allwords` &language=`german` &showIntro=`0`]]

    produces the following error:
    Error: 	Invalid argument supplied for foreach()	 
      Error type/ Nr.: 	Warning - 2	 
      File: 	/path/to/assets/snippets/ajaxSearch/classes/ajaxSearchConfig.class.inc.php	 
      Line: 	165	 
      Line 165 source: 	foreach ($this->cfg as $key => $value) { 


    Can someone provide help?
      • 21257 MODX Staff
      • 730 Posts
      If that function isn’t getting a proper ’cfg’, it suggests that something is either wrong with the snippet call itself (though what you pasted here looks fine) or the snippet code in the db. I’d be inclined to check that all new ajaxSearch files made it to the server ok (including the file install/assets/snippets/ajaxSearch.tpl) and run the installer again, choose to upgrade, but only upgrade the ajaxSearch snippet.
      If the error persists, can you get any debugging information by turning on the &debug param?
      Also, does the error appear when you first load the page, or in the ajax search results, or on a result page?
        Mike Schell
        Lead Developer, MODX Cloud
        Email: [email protected]
        GitHub: https://github.com/netProphET/
        Twitter: @mkschell