We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 4749
    • 623 Posts
    Has anyone ever integrated a google site search into their site? If so, how difficult was the process and how well does it work? Thanks.
      The MODx has you...
      Utah Web Design
      • 4749
      • 623 Posts
      Does anyone know why this might be? When I put a plain old static HTML doc with the same output that modx gives the google site search works. However, when I run it through modx the results page returns a modx error page. The site search is set up exactly how google specifies.
      Here’s the code I used for the search box:
      <!-- Google CSE Search Box Begins  --> 
              <form action="http://www.website.com/search-results.html" id="cse- 
      search-box"> 
               <div> 
                 <input type="hidden" name="cx" 
      value="002972817510330324097:u6ctgynfcxo" /> 
                  <input type="hidden" name="cof" value="FORID:11" /> 
                  <input type="hidden" name="ie" value="UTF-8" /> 
                  <input type="text" name="q" size="25" /> 
                  <input type="submit" name="sa" value="Search" /> 
                </div> 
              </form>
      

      And for the results page, I use this code:
      <div id="cse-search-results"></div> 
      <script type="text/javascript"> 
        var googleSearchIframeName = "cse-search-results"; 
        var googleSearchFormName = "cse-search-box"; 
        var googleSearchFrameWidth = 600; 
        var googleSearchDomain = "www.google.com"; 
        var googleSearchPath = "/cse"; 
      </script> 
      <script type="text/javascript" src="http://www.google.com/afsonline/ 
      show_afs_search.js"></script>
      

        The MODx has you...
        Utah Web Design
        • 25663 MODX Staff
        • 12,272 Posts
        Correct, the internal request string for modx is q= so the parser is trapping it. Uppercase Q gets around this for Google site search.
          Ryan Thrash, MODX Co-Founder
          Follow me on Twitter at @rthrash or catch my occasional unofficial thoughts at thrash.me
          • 4749
          • 623 Posts
          Thanks guys! That was it. Another post, another problem solved! grin
            The MODx has you...
            Utah Web Design