We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 4280
    • 22 Posts
    I’m using AjaxSearch 8.1.1 with the latest MODx install. Two Problems.

    Here’s the code that appears on all pages:
    [!AjaxSearch? &ajaxSearch=`0` &parents=`85` &AS_landing=`98` &AS_showResults=`0` &hideMenu=`0` &filter=`id,86,2|id,95,2|id,96,2|id,98,2`!]


    Here’s the landing page (98) code:
     <!--search_terms-->
    [!AjaxSearch? &ajaxSearch=`0` &AS_showForm=`0` &parents=`85`  &depth=`10` &AS_showResults=`1` &grabMax=`10` &extract=`1`&highlightResult=`1` &filter=`id,86,2|id,95,2|id,96,2|id,98,2`!]


    1. How do I get ajaxSearch to return the correct path for the landing page?

    I have the search box on all pages that appear within "mysite.com/85/…" The landing page is "mysite.com/85/98"

    No matter what page a user is on, and s/he decides to search for a term, the same landing page and its correct path should always be returned. However, that’s not happening. For example if a user is on "mysite.com/85/89" and s/he searches, the path that gets returned is "mysite.com/85/85/98" (results in 404), but SHOULD be "mysite.com/85/98". Notice the redundant "85". This happens on every page except page "85" which correctly directs to "89." Make sense?

    It looks like it has something to do with &parents=`85`. Do I need to edit some code somewhere in /snippts/ajaxSearch/… to make it an absolute path instead?

    How do I correct this?

    2. How do I get the search term to display in the landing page’s title?

    In the landing page document, I have the option of displaying a title for it in the MODx title field. I just need to know the correct syntax to put in there. I should replace "whatgoeshere?" with what?

    Title: Search Results for [+whatgoeshere?+]


    Thanks in advance!
      • 4280
      • 22 Posts
      No responses? This forum isn’t as active as I’d expect. For active users, these types of questions should be easy as pie to answer. This CMS and its plugins aren’t natively easy for everyone to use, and by fielding questions like these are the only way that new folks are going to learn how to effectively use MODx. I see a lot of unanswered questions like these on this forum. I’m really trying to give MODx a try, but it’s becoming increasingly frustrating with little hang ups here and there like these.
        • 5811
        • 1,717 Posts
        Hi BuildIt, I sent you a Personal Message about this post the 13th march:

        Hi BuildIT

        could you send by PM an url address of ypur web site in productions with the issues listed in :
        http://modxcms.com/forums/index.php/topic,33909.msg206216.html#msg206216
        So I waited your answer ...
          • 4280
          • 22 Posts
          I’ve supplied all the necessary code above. I don’t have a link to point to, as it’s on a dev server.
            • 5811
            • 1,717 Posts
            Regarding the point /2, the version 1.8.1 doesn’t provide a placeholder with the search terms

            This placeholder will be added with the next release (1.8.2)
            To get it with the release 1.8.1 adds the two following lines just before the line #28 of classes/ajaxSearch.class.inc.php
                // init searchString as Phx
                $modx->setPlaceholder("as.searchString", $this->searchString);


            So you could write [+as.searchString+] in the page title of your landing page.

            Find enclosed the file updated

            See as example the landing page demo of the release 1.8.2. Search for instance "school" and look at the name of the landing page.
            The title of the document #272 is defined as
            Search results for [+as.searchString+]
              • 20413
              • 2,877 Posts
              Thanks for all your AWESOME and FREE contribution coroico!! smiley
                @hawproductions | http://mrhaw.com/

                Infograph: MODX Advanced Install in 7 steps:
                http://forums.modx.com/thread/96954/infograph-modx-advanced-install-in-7-steps

                Recap: Portland, OR (PDX) MODX CMS Meetup, Oct 6, 2015. US Bancorp Tower
                http://mrhaw.com/modx_portland_oregon_pdx_modx_cms_meetup_oct_2015_us_bancorp_tower
                • 5811
                • 1,717 Posts
                @BuildIT
                If you have friendly urls set up with friendly alias path enabled you need to add right after your opening <head> tag in your template, this href definition:
                <base href="[(site_url)]"></base>
                Is it already done ?

                Your issue is not due to the AS snippet call writing, nevertheless:
                [!AjaxSearch? &ajaxSearch=`0` &parents=`85` &AS_landing=`98` &AS_showResults=`0` &hideMenu=`0` &filter=`id,86,2|id,95,2|id,96,2|id,98,2`!]
                To define your search box, &parents=`85` &AS_showResults=`0` &hideMenu=`0` &filter=`id,86,2|id,95,2|id,96,2|id,98,2` are useless because the search is run on the landing page. This first call display only the input form. This As snippet call is enought:
                [!AjaxSearch? &ajaxSearch=`0` &AS_landing=`98`!]

                [!AjaxSearch? &ajaxSearch=`0` &AS_showForm=`0` &parents=`85` &depth=`10` &AS_showResults=`1` &grabMax=`10` &extract=`1`&highlightResult=`1` &filter=`id,86,2|id,95,2|id,96,2|id,98,2`!]
                For the landing page (#98) &AS_showResults=`1` &grabMax=`10` &extract=`1`&highlightResult=`1` are useless (default values already set). This As snippet call is enought:
                [!AjaxSearch? &ajaxSearch=`0` &AS_showForm=`0` &parents=`85` &depth=`10` &filter=`id,86,2|id,95,2|id,96,2|id,98,2`!]

                  • 10189
                  • 109 Posts
                  Quote from: coroico at Mar 18, 2009, 04:18 PM

                  Regarding the point /2, the version 1.8.1 doesn’t provide a placeholder with the search terms

                  This placeholder will be added with the next release (1.8.2)
                  To get it with the release 1.8.1 adds the two following lines just before the line #28 of classes/ajaxSearch.class.inc.php
                      // init searchString as Phx
                      $modx->setPlaceholder("as.searchString", $this->searchString);


                  So you could write [+as.searchString+] in the page title of your landing page.

                  Find enclosed the file updated

                  See as example the landing page demo of the release 1.8.2. Search for instance "school" and look at the name of the landing page.
                  The title of the document #272 is defined as
                  Search results for [+as.searchString+]

                  I just tried this with AjaxSearch 1.8.4 but nothing shows in the title. Checking the PHx log, I get this:

                  Pass 4
                  
                  106 [11:29:16] MODx Chunks -> Merging all chunk tags
                  107 [11:29:16] MODx / PHx placeholder variable: as.searchString
                  108 [11:29:16]   |--- Skipping - hasn't been set yet.
                  109 [11:29:16] Cleaning unsolved tags: 


                  The placeholder is in the same template as the snippet call. I must be missing something here. I noticed however that the placeholder works inside any of the templates the snippet call uses.