We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 37126
    • 37 Posts
    Hi, my first post here, thanks for a great forum and brilliant CMS.

    Simple one I think? I had the TagCloud snippet from modx extras working previously prior to AjaxSearch 1.9 but now can’t get the links from the cloud to work.

    So the code which originally worked for 1.8.5 was

    http://www.example.com/search-results.html&AS_search=TagWord

    I’ve tried changing it for 1.9.0 to

    http://www.example.com/search-results.html&search=TagWord

    but get a page not found error

    Any suggestions? Thanks in advance
      • 5811
      • 1,717 Posts
      It’s work without a friendly url. For instance try http://www.modx2.wangba.fr/index.php?id=39&search=loi. But you are right, it doesn’t run with a friendly url.
      But It doesn’t run with AS 1.8.5 too.

      Could you post your how is set up your .htaccess file with the version 1.8.5 ?
        • 37126
        • 37 Posts
        It may be that having switched hosts to a windows install of modx maybe the problem. Thanks It does work when not using friendly urls.
        Below is the htaccess file:

        # Helicon ISAPI_Rewrite configuration file
        # Version 3.1.0.48

        RewriteEngine On
        RewriteCompatibility2 On
        RepeatLimit 32
        RewriteBase

        # Block external access to the httpd.ini and httpd.parse.errors files
        RewriteRule ^/httpd(?:\.ini|\.parse\.errors).*$ / [NC,F,O]
        # Block external access to the Helper ISAPI Extension
        RewriteRule ^.*\.isrwhlp$ / [NC,F,O]

        RewriteRule ^/(?!(?:manager|assets)/)(.*)\.html(?:\?(.*))?$ /index.php?q=$1?2&$2: [NC,L,U]

        RewriteCond %{HTTP_HOST} .
        RewriteCond Host: (?!www\.)(.+)
        RewriteRule (.+) http\://www.example.com$1 [I,RP]
          • 4310
          • 2,310 Posts
          I’ve found on IIS6 with furl’s the first character after.html needs to be an ?
          If an & is used it causes a 404 error.
            • 28042 ☆ A M B ☆
            • 24,524 Posts
            That is the case with any server. Some are just more forgiving about it than others.

            With friendly URLs, you need to use a ? for your first custom query string pair:
            mypage.html?key=value&key2=value2
            But without friendly URLs you cannot use a ? because it’s already in use
            index.php?id=42&key=value&key2=value2
              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
              • 37126
              • 37 Posts
              Thanks all for the swift response. Changing the & to a ? worked
                • 28042 ☆ A M B ☆
                • 24,524 Posts
                Any snippet that generates links with query string arguments should have a check for whether or not friendly URLs is in use, and set the character to use accordingly. The setting to check for is $modx->config[’friendly_urls’]; if it’s 1 then use ? if it’s 0 then use &.
                $firstarg = $modx->config['friendly_urls'] ? '?' : '&';

                should do the trick.
                  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
                  • 37126
                  • 37 Posts
                  Quote from: sottwell at Jul 22, 2010, 05:21 AM

                  Any snippet that generates links with query string arguments should have a check for whether or not friendly URLs is in use, and set the character to use accordingly. The setting to check for is $modx->config[’friendly_urls’]; if it’s 1 then use ? if it’s 0 then use &.
                  $firstarg = $modx->config['friendly_urls'] ? '?' : '&';

                  should do the trick.

                  Thanks that works a treat!
                    • 28042 ☆ A M B ☆
                    • 24,524 Posts
                    and the beauty of that is that if you need to change from friendly URLs to not (or vice versa) for some reason, it’ll still work.
                      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