We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 7455
    • 2,204 Posts
    I could not find it but maybe somone had a brilliand idea on how to do this.
    I like to use AjaxSearch to search in catacories but that must be selectible by the user so instead of using &parents, I like to use a puldown or selectbox option to let the user search in that category and that AS that id grabs as parents.

    Is this possible or do I need to hack the code?

    [edit]
    I hacked the code to make it posible to add a puldownselect list from the parents.

    I added a parameter: &makeParentList if set then there wil be a placeholder available that creates a pulldownlist from pagetitles corresponding with the id’s that are set in &parents called: [+as.parentsList+]
    it uses the getField class so you need to copy the getField.inc.php into the includes folder from ajaxSearch.

    don’t forget to put the placeholder in the form in template.inc.php.

    I add the files to this treat
    [/edit]
      follow me on twitter: @dimmy01
      • 5811
      • 1,717 Posts
      Thks Dimmy for this interesting suggestion. I think that it is not easy to hack the current code, but as I am worked on the next release, may be I could integrate this option.
      From my point of view, the selection of a "category" could be managed as the searchWordList parameter. You could see this option runs here

      For instance by defining a parameter &categories=`area1,area2,area3,area4` where when linked with &parents=`12,34,67,78` the selection of "area3" restrict the search to the subset provided by the parent #67. And a selection of "area2" and "area4" restrict the search to &parents=`34,78`

      And the same thing if you use the &documents instead of &parents.

      But have you any idea of how I could manage this new parameter if I get a number of categories smaller than the entries in the &parents or in the &documents ? May be by create an category name by "category#id"

      Thanks for your comment about this proposal
        • 7455
        • 2,204 Posts
        mm ok
        but the pulldown you use are fixed words to search for instead of place to search in.
        there must be a field where you could type in any search word that can be found in the catecory.

        what I would do is create an extra piece of code that maybe looks at the parents and fropm that grab the pagetitle and create a pulldownlist of checkbox list then on post the parent is set by the pulldown.
        now the snippet gets the parenbts beforhand but could it not be posible to look at a $_POST[’parents’] and if isset then use that instead of the one set in the call.

        Dimmy
          follow me on twitter: @dimmy01
          • 7455
          • 2,204 Posts
          ok I changed the snippet.ajaxSearch.inc.php
          so it looks like this on line 177

          // IDs of documents to retrieve their children to &depth depth  where to do the search
          if(!isset($_POST['parents'])){ //added by dimmy, use a post value for parents instead of the snippetcall value
          $parents = isset($parents) ? $parents : false;
           }else {$parents = $_POST['parents'];} //added by dimmy, use a post value for parents instead of the snippetcall value
          


          and I added a field to the template php file so i could type in parents by hand, and that worked
          so only a small function is needed that looks to the parents that are set in the call and create a puldown list from that with pagetitles and we are set.

          and then offcourse a extra parameter that is called something like &useParentSelectList=`1` to swith it on and off.

          Dimmy

            follow me on twitter: @dimmy01
            • 7455
            • 2,204 Posts
            I changed the code a bit maybe you or anyone likes to use it;

            I adde a parameter: &makeParentList if set then there wil be a placeholder available that creates a pulldownlist from pagetitles corresponding with the id’s that are set in &parents called: [+as.parentsList+]
            it uses the getField class so you need to copy the getField.inc.php into the includes folder from ajaxSearch.

            don’t forget to put the placeholder in the form in template.inc.php.

            I add the files to this treat
              follow me on twitter: @dimmy01