PassMark Logo
Home » Forum

Announcement

Collapse
No announcement yet.

Search returns to homepage

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

  • Search returns to homepage

    Hey guys

    I've installed the free edition of Zoom but will definately be purchasing a few licenses IF i can sort this problem out. The way that my site's are designed normally involve an index.php page containing my template (persistent elements like header, nav and footer etc). A content DIV is then used to display my content and a small php script included to pull in the contents of the individual pages. This therefore means that my URLs would look something like this:

    http://www.springmove.com/dev/index.php?page=search

    Now, I've put the necessary search files on my server and linked to it using index.php?page=search and the form loads nicely (complete with my site's CSS and template rules). Unfortunately, when I click Search it simply jumps back to index.php You can see the effect by going to the above URL.

    I'm guessing this is something to do with the way that I have designed the site, and the form action (self URL) is loading index.php and not getting any further. If I just load search.php and do a search it throws back results just fine!

    Does anyone have any suggestions as to how I can get this working properly within my template? Preferably without a site redesign!

    Here is the php code snippet to pull my pages into the template, just for reference:

    <?php
    $page = $_GET['page'];
    if((!$page)||(empty($page))){
    $page = "home";
    }
    include("$page.php");
    ?>

    Any help would be greatly appreciated! Thanks in advance!

    Mark

    EDIT: After studying the URLs returning after doing a proper search and then trying it within my site, it seems that it is trying to pass the results to index.php and not search.php Is this at all fixable?

    http://www.springmove.com/dev/index....=0&zoom_sort=0

    http://www.springmove.com/dev/search...=0&zoom_sort=0

  • #2
    Passing the parameters to "search.php" will allow the search script to work, but as you can see in that last URL you mentioned, the search results will NOT be "wrapped" in the look and feel you are hoping for, using your "index.php" script.

    We should also note that your method of using include() to wrap scripts within your own is likely to cause problems with other scripts in the future, especially considering that this essentially combines the scripts and the page will need to be sharing parameters.

    Nonetheless, this is possible by changing the "Link back URL" in the Configuration window, under the "Advanced" tab. Here you can specify where the form submits the values to, and if you set this to "search.php", this will allow the values entered into the search form to be passed to this URL:
    http://www.springmove.com/dev/search...=0&zoom_sort=0

    Now the recommended usage here is that you then simply modify "search_template.html" to fit the look of your site. And everything will work fine.

    There is an alternative approach that you can look into though. The problem you are having is that you have essentially "wrapped" our search script within your own script (index.php) here:
    http://www.springmove.com/dev/index.php?page=search

    Now Zoom doesn't realize this, and when you submit a search, it is sending it to here:
    http://www.springmove.com/dev/index....=0&zoom_sort=0

    This doesn't work because your "index.php" script needs the "page=search" parameter in the URL for it to access the search page. What you really want, is for the search page to send to here:
    http://www.springmove.com/dev/index....=0&zoom_sort=0

    How can you do this? Well, it's a tricky scenario, but one with several possible workarounds. You have to add the "page=search" parameter to the HTML search form as a hidden value. One way to do this is to define your own search form, and include the following:

    <input type='hidden' name='page' value='search'>

    Alternatively, you can modify the generated search form to include this tag by following the instructions below:

    Click on the Configuration window, and select the "Languages" tab. The language file selected is presumably "English.zlang", click "Edit file". Change the entry for the search form text like so:

    Code:
    STR_FORM_SEARCHFOR=<input type='hidden' name='page' value='search'>Search for&#58;
    Save your changes, and re-index your site. You should find now that this extra parameter is part of your search form and when you submit a search, it will work successfully, all while wrapped under your "index.php" script. There may be some additional issues to iron out though, as I can not guarantee that your script does not cause conflict with other parts of Zoom. But nonetheless, I hope the above is of help.
    --Ray
    Wrensoft Web Software
    Sydney, Australia
    Zoom Search Engine

    Comment


    • #3
      WOW that was some answer mate! All working great now after following your instructions about changing the search form string in the language file! Much appreciated! On a similar note, you mentioned that the method being used to essentially 'wap' pages within my template may cause problems later on with various other scripts (possibly other Zoom enhancements). In your expert opinion, what method would you suggest to achieve similar results. I have used includes before although found this method prone to errors. Plus I still had to include headers and footers etc on 'every' page.

      Once again, many thanks for your prompt reply.

      Comment


      • #4
        Better methods of maintaining a consistent layout is often to have each of your web page call in (or "include") the common header and footer required (as opposed to the other way around... having a layout file which "includes" the actual content). This is simply because in most cases, the header and footer are much simpler and will not vary much (whereas the content can be very different from one page to the next, and can get more complex - in this case, a search script).

        Yes, it does mean requiring each file on the website to 'include' a header or footer. However, changing the layout of the site should only require changing the common header/footer file and not every page again. If you are trying to apply this onto an existing website (which was not originally architectured for such flexibility) then it would be more troublesome, but that's unfortunately the nature of the beast. There are however, various web design tools out there that allow better management of applying changes across all webpages - such as Dreamweaver's built-in Assets and Library item feature.
        --Ray
        Wrensoft Web Software
        Sydney, Australia
        Zoom Search Engine

        Comment


        • #5
          Many thanks for your reply Ray. Yes I can see why including the actual header / footer onto the page content would be a better way of doing things. And it seems I may have to go down that route if I want to get the Zoom search to work - which I think is an excellent product!

          Thanks again for all your help

          Comment

          Working...
          X