PassMark Logo
Home » Forum

Announcement

Collapse
No announcement yet.

defining own search form on search.php

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • defining own search form on search.php

    I have already defined my own search form on my home page

    If I also define my own search form on the search.php page, will the text entered into the search box on my home page still appear in the search box on the search.php page?

    If not, how can I get it to do that?

    Thanks

  • #2
    In addition, I'd like to know how I can set the default to 100 results per page instead of 10, thanks.

    Comment


    • #3
      If you are using our default search form, then yes, the search terms are carried across from one page to the next.

      If you are defining your own forms, then our script won't know how to fill out your form.

      You would need to write some extra code to do this.

      To get 100 results instead of the default 10 per page, you need to include, "&zoom_per_page=100" in the URL. You can do this by adding a hidden HTML form variable to your form.

      ----
      David

      Comment


      • #4
        Would the code needed to be added to carry the search terms from one form to the next be something like this? Could you suggest alternative code if not?

        print("<form method=\"get\" action=\"".$SelfURL."\" ");
        print( " <input type=\"text\" name=\"zoom_query\" size=\"20\" value=\"".htmlspecialchars($query)."\" ");
        print("<input type=\"submit\" value=\"search"\ .

        Comment


        • #5
          Unfortunately not. It depends too much on how your search form is defined.

          Those 3 lines of code above were taken from search.php, but they assume that the required variables are pre-populated with the information needed by the code before it. It will not work on its own. In addition to this, they are PHP code. You can not insert PHP code in the search_template.html file unless you are implementing it in a wrapper PHP file as mentioned here. So something like that would only work in that scenario.

          If you are using a normal search_template.html file and no PHP wrapper file, you would then require additional Javascripting to parse the search parameters from the page URL and fill in the appropriate values in your search form. As mentioned above, we do not provide this Javascript because it varies too much from site to site, and really needs to be implemented on a site-by-site basis.

          The recommendation is that if you wish to go the easy way with having your search form automatically populated - then use the default search form generated by Zoom. You can customize it a fair deal via CSS.

          If you wish to define your own search form, then it is assumed that you will be creating all aspects of this search form, and it is all up to you - including the aspect of scripting which fills in the form for you. Try a Google search for "javascript extract URL parameters" and "javascript fill in forms".
          --Ray
          Wrensoft Web Software
          Sydney, Australia
          Zoom Search Engine

          Comment


          • #6
            OK.

            How can I get rid of the "Search for" text before the search box using CSS and replace it with text of my choice e.g. "ChemRefer Search" (since my site is called chemrefer.com).

            I was going to do it from settings.php but it says not to edit that file.

            Comment


            • #7
              On a separate topic: how to make database entries accessible to Zoom, this script has been suggested to me:

              <?
              include("./lib.php");
              $res=sql("select pkField, keywordField from tablename");
              while($row=mysql_fetch_row($res)){
              echo "<a
              href=\"tablename_view.php?SelectedID=$row[0]\">$row[1]</a>
              ";
              }
              ?>

              do you think that would work?

              Comment


              • #8
                You can change the search form text by creating your own language file. See the languages tab in the Zoom configuration window.

                Extract from the help file,
                You can modify the text that appears on the search page and search results, by customizing the Zoom Language Files (.ZLANG files). Almost every bit of text on the search page can be modified or translated, including “Search results for…” and “x results found”, etc. This allows you to translate the search page to the language of your choice, without having to modify the search script.

                Zoom also comes with a few pre-translated language files which both serve as examples, and allow you to create French or German search pages straight out of the box, by selecting it from the dropdown menu.

                -----
                David

                Comment


                • #9
                  Information about indexing databases and database driven sites is available here,
                  http://www.wrensoft.com/zoom/support/faq_howto.html#sql.

                  The exact database query required to get data from your database and present it as meaningful text will depend on your database. There is no single script that will work for all databases because the following items will vary from one DB to the next.
                  - The type of DB (SQL, Oracle, Access, etc..)
                  - The number of tables,
                  - The number of fields in each table
                  - The variable types stored in the fields. (Integers, text or dates)
                  - The relationship between the tables
                  - The meaning of the data itself

                  ---
                  David

                  Comment

                  Working...
                  X