We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 20911
    • 84 Posts
    how can i use ajaxsearch with this php code to load a result page for the users input value

    $xmlDoc = new DOMDocument();
    $xmlDoc->load("links.xml");
    
    $x=$xmlDoc->getElementsByTagName('link');
    
    //get the q parameter from URL
    $q=$_GET["q"];
    
    //lookup all links from the xml file if length of q>0
    if (strlen($q) > 0)
    {
    $hint="";
    for($i=0; $i<($x->length); $i++)
      {
      $y=$x->item($i)->getElementsByTagName('title');
      $z=$x->item($i)->getElementsByTagName('url');
      if ($y->item(0)->nodeType==1)
        {
        //find a link matching the search text
        if (stristr($y->item(0)->childNodes->item(0)->nodeValue,$q))
          {
          if ($hint=="")
            {
            $hint="<a href='" .
            $z->item(0)->childNodes->item(0)->nodeValue .
            "' target='_blank'>" .
            $y->item(0)->childNodes->item(0)->nodeValue . "</a>";
            }
          else
            {
            $hint=$hint . "<br /><a href='" .
            $z->item(0)->childNodes->item(0)->nodeValue .
            "' target='_blank'>" .
            $y->item(0)->childNodes->item(0)->nodeValue . "</a>";
            }
          }
        }
      }
    }
    
    // Set output to "no suggestion" if no hint were found
    // or to the correct values
    if ($hint == "")
      {
      $response="no suggestion";
      }
    else
      {
      $response=$hint;
      }
    
    //output the response
    echo $response;
      Mysql 5.1.52
      Apache 2.2.17
      PHP 5.2.12
      Linux
      • 8609
      • 607 Posts
      Quote from: Nameless? at Feb 02, 2010, 06:59 AM

      u really sure about that? as i see here this is the same one :-/ http://www.battlefieldnations.com/

      I second what Susan said. If you look at the code of the AjaxSearch snippet and it’s config files and all that, you’ll see that it needs the MODx core installed and present to work. Maybe the snippet author or someone else has an idea of how it could be recoded to work outside MODx. But it’s the same as trying to use a WordPress plugin inside your own CMS as is. I don’t think it’s possible, but maybe someone will prove me wrong.
        • 20911
        • 84 Posts
        did u see the link above?
          Mysql 5.1.52
          Apache 2.2.17
          PHP 5.2.12
          Linux
          • 8609
          • 607 Posts
          Quote from: Nameless? at Feb 02, 2010, 10:34 AM

          did u see the link above?

          If you’re talking about http://www.battlefieldnations.com/, yes I did look at it. If you look at the page source you’ll see every indication that that website is built using MODx, hence AjaxSearch would work perfectly in it.
            • 28042 ☆ A M B ☆
            • 24,524 Posts
            I don’t think this is a stock MODx since adding /manager to that link doesn’t get a manager login; at least this isn’t 0.9.6x or 1.0.x evolution. Either that or they’ve done some fancy .htaccess rewriting for the manger, maybe? Or could it be Revo?

            Interesting, how the developer of that site describes how they "have built up a system" for a CMF, especially considering how their support file structure and several features are obviously MODx (AjaxSearch and MaxiGallery).

            http://www.rossco-designs.com/Services/content-management-framework
            http://www.rossco-designs.com/Portfolio/websites/battlefield-nations
              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
              • 8609
              • 607 Posts
              Quote from: sottwell at Feb 02, 2010, 02:50 PM

              I don’t think this is a stock MODx since adding /manager to that link doesn’t get a manager login; at least this isn’t 0.9.6x or 1.0.x evolution. Either that or they’ve done some fancy .htaccess rewriting for the manger, maybe? Or could it be Revo?

              Interesting, how the developer of that site describes how they "have built up a system" for a CMF, especially considering how their support file structure and several features are obviously MODx (AjaxSearch and MaxiGallery).

              http://www.rossco-designs.com/Services/content-management-framework
              http://www.rossco-designs.com/Portfolio/websites/battlefield-nations

              I did notice the manager thing. I figure they must have done some fancy rewiring, maybe used MODx as a base to build their own CMS around?
                • 5811
                • 1,717 Posts
                May be Rossco can give us the answers ?
                  • 20911
                  • 84 Posts
                  yes he have done
                    Mysql 5.1.52
                    Apache 2.2.17
                    PHP 5.2.12
                    Linux
                    • 25551 ☆ A M B ☆
                    • 1,231 Posts
                    coroico messaged me to say that one of my sites is in question... grin

                    My battlefieldnations website is using modx but it’s heavily modified to suit some ideas I have for the site. Regardless of the modifications, it’s modx I am using and ajaxsearch.

                    Ross
                      Ross Sivills - MD AugmentBLU Edinburgh, Scotland UK
                      AugmentBLU - MODX Partner

                      BLUcart - MODX Revolution E-Commerce & Shopping Cart
                      • 20911
                      • 84 Posts
                      thats good smiley im trying to install this but wont give me any luck... will give it a try again cool
                        Mysql 5.1.52
                        Apache 2.2.17
                        PHP 5.2.12
                        Linux