I’ve got Ajax Search working in it’s basic form, but I want to enable the advanced option search as per the demo site.
http://www.modx.wangba.fr/index.php?id=144
I tried using the code given but it just appears as code on my search page.
[!AjaxSearch? &ajaxMax=`4` &extract=`99` &tplLayout=`optionSearch` &showMoreResults=`1` &moreResultsPage=`169`!]
and I created a chunk called optionSearch based on the one in the included templates.
I’ve probably missed a step or two, so any help would be appreciated.
Thanks
Content Creator and Copywriter
-
☆ A M B ☆
- 24,524 Posts
Are you sure the snippet name is exactly AjaxSearch? Usually when the snippet call appears as text in the output it’s because the snippet wasn’t found due to a typo in the snippet name/snippet call.
-
MODX Staff
- 1,535 Posts
Also, did you copy and paste the snippet call directly from the wangba.fr site?
If you did, that might be your problem. The snippet call on that demo page has been constructed in a way that it won’t be parsed by the MODx parser (for obvious demo purposes). Best option would be to delete the snippet call and manually type it in to avoid that particular issue.
Garry Nutting
Senior Developer
MODX, LLC
Email:
[email protected]
Twitter: @garryn
Web: modx.com
Garryn,
well that is truly weird.
I retyped the call as you said and it worked.
Thing is I can’t see the difference between the two.
Huh?
Here’s both. The top one is the copy and paste that doesn’t work, the bottom one is the retyped version that does.
[!AjaxSearch? &ajaxMax=`4` &extract=`99` &tplLayout=`optionSearch`
&showMoreResults=`1` &moreResultsPage=`169`!]
[!AjaxSearch? &ajaxMax=`4` &extract=`99` &tplLayout=`optionSearch` &showMoreResults=`1` &moreResultsPage=`169` !]
Very spooky, Mulder.
Thanks anyway.
Content Creator and Copywriter
Hmmm,
maybe, but both the examples I pasted below are direct from the html source editor.
Anyway, I never trust TinyMCE with code. (Or any wysiwyg for that matter.)
And I don’t like TinyMCE’s source editor that much either. Note to self: In future toggle Edit Area on when writing code.
Content Creator and Copywriter
-
☆ A M B ☆
- 24,524 Posts
Ah, the linebreak in the first one killed it. Snippet calls and all their parameters have to be on one line.
That’s why a lot of the complex snippets are now offering the use of external config.php files, so you only need one parameter, the name of your config file. You put the appropriately named config.php file in the assets/snippets/snippetname/config folder, and use standard PHP variable assignment lines to set the parameters. Makes life a lot easier when you’ve got a dozen or so complex parameters in a snippet call.