We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 8527
    • 8 Posts
    I am trying to get Google custom search working in one of my projects but so far I have ran into nothing but problems. I have set up a resource that has the iFrame code google provided, and a Chunk that has the form code provided by Google with the q replaced by Q to work with modx. What’s happening is when I set the form action for the search box to http://sagelladev.ericfarley.net/index.php?id=11 the page I land on strips out the id=11 so I am sent back to the homepage with the Google query string. If I use my friendly URLs and set the action to http://sagelladev.ericfarley.net/search.htm the search form will take me to the correct page but the content isn’t displayed. I have added a <h2>hello world</h2> block into the container to see whats happening and it is not displayed on ../search.htm however when you go to /id=11 it is displayed. Any help figuring out what is happening here, and why the content area isn’t being displayed would be fantastic.

    I am running Modx Evolution 1.0.2, PHP 5.2.12, Apache 2.2.14 and mySQL 5.0.89-community on a Linux box.

    http://sagelladev.ericfarley.net/index.php?id=11 (Search results page where you can see Hello World)
    http://sagelladev.ericfarley.net/search.htm (Friendly URL alias for id=11, hello world is no longer visible)

    Search Resource code:
    <p>
    <script type="text/javascript">// <![CDATA[
      var googleSearchIframeName = "cse-search-results";
      var googleSearchFormName = "cse-search-box";
      var googleSearchFrameWidth = 600;
      var googleSearchDomain = "www.google.com";
      var googleSearchPath = "/cse";
    // ]]></script>
    <script src="http://www.google.com/afsonline/show_afs_search.js" type="text/javascript"></script>
    </p>
    <h2>Hello World</h2>


    Search Chunk code:
    <form action="http://sagelladev.ericfarley.net/search.htm" id="cse-search-box">
      <div>
        <input type="hidden" name="cx" value="005544702991511883657:p2oil63wr88" />
        <input type="hidden" name="cof" value="FORID:9" />
        <input type="hidden" name="ie" value="UTF-8" />
        <input type="text" name="Q" size="31" id="searchBox" value="Search" />
        <input type="image" name="sa" src="assets/images/template/searchBtn.png" value="Search" id="searchBtn" />
      </div>
    </form>
    <script type="text/javascript" src="http://www.google.com/cse/brand?form=cse-search-box&lang=en"></script>