PassMark Logo
Home » Forum

Announcement

Collapse
No announcement yet.

How do you get search results on new web page alongside other html (Newbie)

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

  • How do you get search results on new web page alongside other html (Newbie)

    Hi,

    I'm new to Zoom and am not too experienced at HTML/CSS so please be gentle with me!!! I'm using javascript at present because i'm developing the web site locally first. I've created a simple search form on my home page as follows:

    <div id="sitesearch">
    <!-- Site Search-->
    <form method="GET" action="site_search_local/search.html" class="sitesearchform">
    <table cellspacing="0" cellpadding="0" width="200" border="1">
    <tr class="sitesearch">
    <td class="searchfixedtext" width="50"><b>Search...</b></td>
    <td class="searchtext" value="" width="140"> <input name="zoom_query" type="text" size="22"> </td>
    <td class="searchimage"> <input type="image" src="liveimages/search.gif" </td>
    </tr>
    </table>
    </form>

    <script language="text/javaScript">
    ZoomSearch();
    </script>
    <noscript>
    You must have JavaScript enabled to use this version of the search engine.
    </noscript>
    </div>

    The home page obviously contains menus and content etc. The search form works in that it produces the correct search results. However, the results are presented in the same window but the page is refreshed (ie previous menus and other home page details no longer displayed). I understand how to modify the CSS to get the results presented in the style you want but I just can't grasp how to get the results to load in a new web page (ie I want the results to appear in a seperate web page, which also has the main menus etc on.)

    I've tried modify search.html (in output directory) to include the menus and other content but it doesn't work (doesn't load results page, relative url's now wrong)

    I've tried creating a new search page in the same directory as index.html which references search.html in output directory but (as expected) again no search results (just keeps loading home page)

    I've also looked at these links from previous threads but still can't grasp it
    Q. How do I add search boxes to my web pages?
    Q. How do I modify the appearance of the search form?
    Q. How do I create search forms with images for buttons, etc.?

    I know that I am doing something obvious that is wrong but have read the manual 3 times and I can't for the life of me figure out what it is!!!

    Any help welcome!!

    Regards
    Keith
    Last edited by StormyK; Mar-08-2011, 01:35 AM.

  • #2
    It would probably be easier if you can give us the URL to the web site so we can take a look directly. It's hard to tell from your description alone what you might be doing wrong.

    If it's not live yet, you can PM us the details or e-mail us.

    Originally posted by StormyK View Post
    I've tried modify search.html (in output directory) to include the menus and other content but it doesn't work (doesn't load results page, relative url's now wrong)
    If there's no results, you've probably removed or broken some of the HTML to include the Zoom Javascript and call the search function.

    If the relative URLs are wrong, first, the question is which URLs, are we just talking about the menus, etc. In which case, this would be your own HTML that you would have to change to reflect the location of the page.
    --Ray
    Wrensoft Web Software
    Sydney, Australia
    Zoom Search Engine

    Comment


    • #3
      Hi

      Thanks for the response.

      It's being developed offline at present so I will email it to you.

      Regards
      Keith

      Comment


      • #4
        Hi Guys,

        Sent the email this morning (UK time) to zoom@wrensoft.com. Any comments yet?

        Regards
        Keith

        Comment


        • #5
          I've written back to your e-mail. The problem is with your offline <base href= URL as noted. Hope it helps.
          --Ray
          Wrensoft Web Software
          Sydney, Australia
          Zoom Search Engine

          Comment


          • #6
            Hi Ray,

            Thanks for the response. I acknowledge the issues with using <base> tag (file reference system I've used actually works fine though). It was only being used temporarily to get everything working with the intention of changing the references in due course when most of the work had been done, in readiness to complete on the server.

            Anyway, I've re-output all the search files to the same directory as index.html alongside the test script and all works fine now

            Many thanks for your help.

            Keith

            Comment


            • #7
              Having issues now when transfer from Javascript to CGI

              Hi,

              I've got the javascript version working well now with my test files and am ready to transfer to CGI version.

              In the javascript (HTML) setup I use a custom search form to do the search using
              <form method="GET" action="searchtestjava.html" class="sitesearchform">
              <table cellspacing="0" cellpadding="0" width="190" border="1">
              <tr class="sitesearch">
              <td class="searchfixedtext" >Search...</td>
              <td class="searchtext" > <input name="zoom_query" type="text" size="20"> </td>
              <td class="searchimage"> <input type="image" src="liveimages/search.gif" </td>
              </tr>
              </table>
              </form>
              <script language="text/javaScript">
              ZoomSearch();
              </script>

              This loads "searchtest.html" which contains the search results from the index.html web page with the appropriate layout and menus.

              I've modified the code and created the necessary indexes using spider mode/CGI/Linux platform and uploaded this to the server (to cgi-bin).

              I've changed the action="searchtest.html" to "/cgi-bin/search.cgi" as per the manual. I've removed the javascript and associated meta and added <!--ZOOMSEARCH-->

              I've tested the search with the search.cgi script (www.mcfc.me/cgi-bin/search.cgi) which works fine.

              The home page (www.mcfc.me) loads fine, but when I carry out a search from my custom form (top RHS), I just get the standard search results (ie not in web page - not really surprising as it's using search.cgi in the form!!). How do I get it to load the CGI equivalent of "searchtest.html". If I use "searchtest.cgi" in the form, this file obviously doesn't exist. However "search.cgi" will clearly load the default search form. What am I missing? It seems that I need to create a searchtest.cgi, but how?

              Apart from the learning curve, looks like a great product and can see me using this on many projects.

              Regards

              Keith

              Comment


              • #8
                The JavaScript version (by nature of the scripting platform) is quite different from how the CGI or PHP/ASP versions work. This is because JS is client-side scripting, while CGI/PHP/ASP is what's known as server-side scripting. While we would love to make them consistent (and thus easier for beginners to tackle), the platforms themselves do not make this possible because they are so vastly different. So some things you have to know.

                These differences are described in chapter 3 and chapter 4 of the Users Guide in detail.

                While "search.html" is the page you open in the browser for the JS version and also the page you modify to define its appearance, for the CGI, you open "search.cgi" and you modify "search_template.html" to customize its appearance.

                Simply put, you haven't modified the "search_template.html" file that resides in the cgi-bin folder (alongside "search.cgi"). This is the file that should have the <!--ZOOMSEARCH--> tag specifying where the search results will appear in context of the layout.

                Note that since you it is in a subfolder, once again you have to deal with the issue of your menu links needing to be one level up (e.g. "../mymenus.js"). Unless you can configure your website to allow CGIs to execute from the root folder.

                Note that PHP or ASP scripts will typically run from any folder (if available on the server).
                --Ray
                Wrensoft Web Software
                Sydney, Australia
                Zoom Search Engine

                Comment


                • #9
                  Hi Ray,

                  Thanks very much for your prompt response.

                  I do fully understand the difference between client and server side scripting (whilst not that familiar with html/css/php have worked in IT for 20+ years!!!). I have also read chapters 3 & 4 several times and all I can say is that it is not very clear for this particular subject. This is the exception in the manual which is very clear and well written, but I suspect there's a bit of 'can't see the wood for the trees' here! Perhaps the manual needs to be changed to put a specific example in there showing directory structures.

                  With regards to directory structures, I have to say that I have always been taught to organise all of my resources (indexes, images etc) in seperate directories for ease of management. I don't find zoom very accomodating in this respect (but can work with it). For example, don't really see why (by default) the styles are included in the html script (as opposed to a seperate CSS file). I know you can do this manually (as I have done) but would have thought that good programming practice would encourage a good file organisational structure.

                  Anyway, thanks very much for the pointers. I'll re-read Chapters 3 & 4 (for the 3rd time!!) and have another go.

                  Great support by the way!!

                  Regards

                  Keith

                  Comment


                  • #10
                    Hi Ray,

                    OK. I've been trying to reconfigure my hosting service to allow CGIs to execute from the root folder as per your suggestion. As suspected, my hosting company will not accomodate this due to security issues. This was their response:

                    "CGI scripts need to be run within the cgi-bin folder. This is separate from httpdocs as CGI scripts by nature are a security risk, hence the separate folder ensures your site is protected".

                    It's therefore not ideal that Zoom is implemented in this manner if this is the case although I accept it can be worked around.

                    "Note that since you it is in a subfolder, once again you have to deal with the issue of your menu links needing to be one level up (e.g. "../mymenus.js"). Unless you can configure your website to allow CGIs to execute from the root folder."
                    As a result, I presume that I will now have to alter all my relevant relative file references to be relative to /cgi-bin to get everything to work.

                    Also, I've re-read Chapters 3 & 4 again and I'm really sorry, but they don't explain things at all and certainly don't tell me anything relating to my issue.

                    P96 refers to search_template.htm as ..... a template file that defines the appearance of the search page. See “How do I customize my search page?” for more information. It then tells about the parameters that can be changed and details the CSS classes (which I fully understand). It gives an example of a custom form (section 6.5) and how to add a search form (section 6.6). But it doesn't tell you how to implement it!!

                    I've evaluated 2 other search products at the same time and I believe that Zoom is the best (and the one I would like to implement). Understanding and utilising the functionality within Zoom has been a breeze but I have really struggled with the install process and organisational structure of Zoom.

                    Anyway, I'll carry on..... I'm sure I'll get there eventually

                    Sorry for the ranting....... a little frustrated at present!!

                    Regards

                    Keith

                    Comment


                    • #11
                      I have to say that I have always been taught to organise all of my resources (indexes, images etc) in seperate directories
                      Zoom doesn't use any images files of its own. So I don't see why having images (of which there aren't any by default) and indexes in separate directories is a concern.

                      For example, don't really see why (by default) the styles are included in the html script (as opposed to a seperate CSS file)
                      It means one less file, and one place to edit to customise the results page. Makes it simple for novice users. It makes a huge amount of sense to have a separate CSS file where the CSS is used on multiple pages. But this is not the case. Experienced web developers can move the CSS wherever they want however.

                      It's therefore not ideal that Zoom is implemented in this manner if this is the case although I accept it can be worked around.
                      Putting CGI files in the CGI-BIN folder isn't a Zoom requirement. It is a requirement from your web host. But it is standard practice for the last 20 years. Everyone has been doing this since the NCSA HTTPd web server was developed in early 90's.

                      As suspected, my hosting company will not accomodate this due to security issues. This was their response:
                      No surprise. I am sure they would be totally unable to define what the security concern was, compared to for example a PHP script, which can run in the root. But it shouldn't matter. There is no real reason to run it in the root (except to save you maybe 1 minutes work fixing up you relative paths in the search_template.html file).

                      Comment


                      • #12
                        Perhaps I need to clarify.

                        Originally posted by StormyK View Post
                        OK. I've been trying to reconfigure my hosting service to allow CGIs to execute from the root folder as per your suggestion.
                        That was never intended as a suggestion. What I said was this:

                        Originally posted by Ray View Post
                        Note that since you it is in a subfolder, once again you have to deal with the issue of your menu links needing to be one level up (e.g. "../mymenus.js"). Unless you can configure your website to allow CGIs to execute from the root folder.
                        My actual suggestion (in our e-mail exchange) was that you really should have menu links which are relative paths and updated to reflect their folder location.

                        From my email:

                        Usually, common web development practices would mean actually changing the paths to reflect the location of the file. This is often managed for you with web authoring programs like Dreamweaver or FrontPage (when you move a file to a subfolder, it will prompt to change all the paths accordingly), so that a link that previously went to "js/pslivescript.js" will be changed to "../js/pslivescript.js", etc.
                        What I was saying is that, if you are adamant in avoiding changing the links (which is common web development practice) then you would have to resort to less common usage scenarios. And I gave the one exception to where you can avoid that with the CGI, is if CGIs were enabled in the root folder.

                        I did not approve or recommend this, and Zoom definitely does not have such a requirement or expectation.

                        Originally posted by StormyK View Post
                        As a result, I presume that I will now have to alter all my relevant relative file references to be relative to /cgi-bin to get everything to work.
                        Yes. The link references in "search_template.html" needs to be relative to them being in "/cgi-bin" for it to work.

                        This is no different to making a web page that will be hosted in a "/news" subfolder, or any subfolder of your website. I pointed out the problem with using BASE HREF tags, and how different browsers treat them differently especially when you are using them offline via file:// URLs.

                        This is an everyday web development issue, and not a Zoom requirement. Links have to be relative to the folder location they are situated. People usually deal with this either:
                        (a) manually
                        (b) use a web authoring package which can handle this for them when they move files between folders.
                        (c) create dynamically generated pages (with server side scripting) which can determine the path as necessary
                        (d) use absolute paths such as "/js/myscript.js" but then you won't be able to test this offline (as you seem to be doing) easily, because the path won't correspond to your computer's hard drive.
                        --Ray
                        Wrensoft Web Software
                        Sydney, Australia
                        Zoom Search Engine

                        Comment


                        • #13
                          Hi Ray,

                          Many thanks for your continued help. It is much appreciated. I do fully understand everything you said in the previous post. As I said earlier, am evaluating zoom (+ 2 other products) so will sort out issues will relative links in due course. Other products work slightly differently.

                          Got Zoom working now on a single page (decided to use PHP version for time being), but have to say that the manual is very lacking in explaining the implementation process IMHO. This could be easily overcome using a simple example. As a sanity check for me, I asked one of our programmers to use the manual and he had similar issues although he did manage to sort it after some prompting by me.

                          Anyway, all is well now and I'm confident that Zoom is the one we'll go for. The one thing I haven't fully grasped yet is what to do when you need pages containing different search layouts eg home page search calls for layout A (eg includes categories, no match option, location on page etc) but a search from a different page requires a different layout (eg search layout excluding categories, different location etc). I understand how to change the page styles & contents. However as search.php uses search_template.html all the time, how do you create the different versions required to achieve the above. Do you have to compile them into different output directories and alter the relative url's accordingly?

                          Regards
                          Keith

                          Comment


                          • #14
                            To add a simple search form (e.g. to the home page) see this FAQ.
                            Q. How do I add search boxes to my web pages?

                            or this FAQ for nicer looking forms with a graphical button,
                            Q. How do I create search forms with images for buttons, etc.?

                            and this FAQ for more complex forms, with a category drop down for example,
                            Q. How do I put search forms on pages besides the search page? (Or define my own search form?)

                            Note that you don't need to edit the PHP script nor the template file in order to add a search form to other (non search related) pages on your site.

                            Comment


                            • #15
                              Hi

                              I'm sorry but I already understand (and have succesfully implemented) all of these. It wasn't what I was asking. Perhaps I didn't explain myself well enough. I was referring to the layout of the search results (not search form). How do I get different search result layouts on 2 different pages (eg 1 set of search results with style A, in location B, size C on one page and another set of search results on a different page with a totally different Style, location, size etc.)

                              Regards
                              Keith

                              Comment

                              Working...
                              X