We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 27423
    • 10 Posts
    Could I use somthing like;
    $cleansedWords = substr($cleansedWords,0,(strlen($cleansedWords)-1));

    Maybe to replace the whitespace as in the old version;
    // replace line breaking tags with whitespace
    	$text = preg_replace( "'<(br[^/>]*?/|hr[^/>]*?/|/(div|h[1-6]|li|p|td))>'si", ' ', $text );


    Anyone?  Please?

    ps I tried this;
     // replace line breaking tags with whitespace
    	$cleansedWords = preg_replace( "'<(br[^/>]*?/|hr[^/>]*?/|/(div|h[1-6]|li|p|td))>'", '+', $cleansedWords );
      • 27423
      • 10 Posts
      Replaced the files using the download from http://www.muddydogpaws.com And back to working search with highlighting, still no livesearch but I give up..
        • 4095
        • 372 Posts
        I’m having trouble with this on 0.9.5 Beta 2

        I do not get live search, and I don’t get highlighting. The JS is being loaded as the animations show while it is searching etc.

        I have followed the instructions at MuddyDogPaws except for step number 4 under How-to use the search highlight plugin
        where it says the following

        # Somewhere in your template or document add the html:  :This will display the terms and a link to remove the highlighting.


        What exactly was that meant to say between the : :ANSWER: <!--search_terms-->

        I don’t think that’s the problem though as I notice the URL’s on the search return page don’t show &highlight=AS_ajax_highlight+AS_ajax_highlight1. The plugin is present and set OnWebPagePrerender (installed & set with Beta2)

        No idea about live search, the call is
        [!AjaxSearch? $ajaxSearch=`1` &ajaxSearchType=`1` &ajaxMax=`10` &extract=`1`!] 
          [img]http://www.emanz.ac.nz/assets/images/logo/emanz-icon_16x16.gif[/img] Emergency Management Academy of New Zealand [br] http://www.emanz.ac.nz[br][br]MODx Sandbox Login: sandbox Password: castle [br]
          Admin Sandbox Login: sandbox Password: castle
          • 12652
          • 228 Posts
          Was going round and round... and round and round...

          the AjaxSearch.js file was not loading, and even when loading it explicitly in the head with a full URL, wasn’t happening.

          I set the page to be non-cacheable and was calling the snippet as non also.

          After trying a ton of stuff, just thought I’d try calling the snippet [[AjaxSearch]].

          The .js is now loading and appears to be working.

          I’m still getting a feel for everything, so not sure if this is a fix, whether it is correct, but it also dawned on me that I think I remember using another snippet that had the same issue, needing to be called as non-cacheable, but if the page itself was set as non-cacheable, then it only seemed to work if the snippet wasn’t called that way.

          Is this proper behavior or an issue? Is this a hard rule, or depends on the snippet in question? Just trying to understand... cheers


          extra credit.... I do seem to be getting the EXCEPTION AJAX: Object required! alert in IE though... any ideas what, why, how to fix?
            | Identity Developments delivers SEO focused web design and web presence services
            - it&#39;s not about websites, it&#39;s about your identity. |
            • 12652
            • 228 Posts
            Can multiple searches appear on a page without interfering with the other or requiring duplicating the snippet with a different name?

            I would like to have a small search form under the header in the navigation that shows up on all pages (in the template), that leads to a search page that includes a search form.

            I would also like a search form on the 404 page that presents results there, and more results leads to the search page as well.

            I can’t seem to get the nav bar search to work... finally got it to not show results in the search form, and to go to the search page, and it shows the results in the search area below the search form on that page... but as soon as I click in that main search form, the cursor pops up imediately into the nav bar search.

            At first, it was giving AJAX errors, but now it seems to work, but having the cursor jump from one box to the other just won’t cut it, especially if the user doesn’t realize that’s what happened.

            And can anyone clarify whether the attributes are to be written as:

            AS_showForm=0
            or
            &AS_showForm=`0`

            The tpl file has them written out the first way.

            thanks

            EDIT - okay, not an ideal solution, but I removed the search input above the content area, forcing the user to go back up to the nav bar to adjust their search.

            Note: the tpl document needs to be cleaned up... &AS_ShowForm appears to be incorrect, and needs to be &AS_showForm... it is listed both ways in different places.

            SideNote: don’t know if any standards are being created for naming conventions, but with case sensitivity and numerous people creating snippets, modules, plugins, etc., it would be good to establish a naming convention ASAP, including tags, directories, files, etc.
              | Identity Developments delivers SEO focused web design and web presence services
              - it&#39;s not about websites, it&#39;s about your identity. |
              • 15987
              • 786 Posts
              identity,
              Sounds like you got everything working, so thats good. I have been meaing to do some updates to this snippet but have not had time to get to it, although, I do have a slightly updated version to be included in the next release of Modx, so I will get that added to the repository.

              At this point the snippet can only be used once on a page due to the id used in the forms for the ajax functionality.
                • 12652
                • 228 Posts
                well... I’m not sure if I do or not... just that it seems to be working... not sure those are the same things.

                Sorry if frustration was starting to ring out there, but I spent half a day working on this, which isn’t necessarily bad because I’m still figuring out MODx anyway (still under a week of use now) and this was the first time working with this Snippet... but it gets frustrating when things don’t work and you find out that you are calling things incorrectly due to mis-prints.

                Is it okay then that it gets called in the nav bar and called again in the main content area, though the showForm is hidden there? Otherwise, how else do I cause the results to appear there. The way I was understanding the docs was it may be necessary to call it one place and then call it again to display results in a different location.

                Can you clarify the &AS_showForm and similar coding, whether it is to be written with the ’&’ or not, `0` backticks or not? Again, this seems to be written both ways in various places.

                What about calling it [!AjaxSearch!] versus [[AjaxSearch]] depending on whether the page is set to no cache or not? I wouldn’t have thought calling it non-cached on a non-cached page would matter, but seems to be the case.

                thanks
                  | Identity Developments delivers SEO focused web design and web presence services
                  - it&#39;s not about websites, it&#39;s about your identity. |
                  • 15987
                  • 786 Posts
                  Can you clarify the &AS_showForm and similar coding, whether it is to be written with the ’&’ or not, `0` backticks or not? Again, this seems to be written both ways in various places.

                  you do need to put a & before each parameter and each parameter setting needs backticks around it. i.e. &AS_showForm=`0`

                  What about calling it [!AjaxSearch!] versus [[AjaxSearch]] depending on whether the page is set to no cache or not? I wouldn’t have thought calling it non-cached on a non-cached page would matter, but seems to be the case.

                  Do to some problems in ver 0.9.2.1 with the regclientscript api function this snippet should be called on an uncached page with [[ ]], this is fixed in the 0.9.5 betas and there is a fix floating around somewhere for 0.9.2.1 so you can call it with [! !] on a cached page.
                    • 20682
                    • 31 Posts
                    Hi Kyle, thanks for this great ajax script. I also had to apply the [[AjaxSearch]] to get it to work. grin One problem I am still having is an IE issue (I haven’t updated to 7 as most of the population still has 6 or under) and cannot see the close.png when viewing the site in IE. I have tried to change the call in .js to close.gif and uploaded an image of that name but it seems to be ignoring the .gif and displaying nothing instead.


                    EDIT: Acutally it IS displaying the .gif image. When I moved my <div>s around I spotted it way up at the top of the page.
                    Here is a screen shot

                    I have highlighted the <div>s in blue and green and the position of the errant close.gif in yellow. Not sure why it’s sitting at the top of the page (unless it is being positioned:absolute?). Although with all this said...it’s still not showing in IE even if it is a gif sad


                    Is there another place within the files that close.png is referenced? Thanks BUNCHES kiss

                    muskokee
                      • 15987
                      • 786 Posts
                      muskokee,
                      you will just need to play around with some css to get it positioned where you want it. I don’t have the code in front of me right now, but I think the image just gets added to the form, so check your styles on the form to make sure there is room for it to be added after the submit button.

                      This discussion is closed to further replies. Keep calm and carry on.