After recently launching a new site I realized that my AjaxSearch wasn’t functioning quite as I had anticipated.

This site was my first attempt at using some of the additional settings available under Tools/Configuration/Friendly URLs to create fulls URL pathways in my MODx installation. The applicable settings (radio buttons) were as follows:

  • Use FriendlyURLs -Yes
  • Use Friendly URL aliases – Yes
  • Use Friendly URL alias path – Yes
  • Allow duplicate URL aliases- Yes

What I had failed to catch as I tested my site was that the search feature functioned just fine until I was on a deeper page. The default action for the TPL contains a relative pathway and with my configuration settings as above, the URLs for the action command were being generated incorrectly on my deeper pages.

The fix was to use &tplLayout in my AjaxSearch call and then insert [(site_url)] into the action command as below:

<form [+as.formId+] action="[(site_url)][+as.formAction+]" method="post">

Although it is not necessarily a complex fix, I though it worth sharing as it could save someone some headaches and maybe a little development time.


View Comments on “AjaxSearch TPL & Friendly URLs in MODx”

You can track this conversation through its atom feed.

  1. Fishcake says:

    Cheers dude, was suffering exactly the same problem.

Leave a Reply

You must be logged in to post a comment.

blog comments powered by Disqus