PassMark Logo
Home » Forum

Announcement

Collapse
No announcement yet.

renaming search.php

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

  • renaming search.php

    I need to integrate another php script into the search page - probably using php include .

    The easiest way would be to do this as your help page says create my_search.php and include my new script with your search.php script
    but this would mean changing all pages with the site search box to this new URL .

    Is it possible to rename search.php to say xsearch.php then i could use search.php instead of my_search.php and would not need to change all pages .

    Thanks
    http://www.ad9.co.uk

  • #2
    It is possible, but it would be a bit tricky. Because when you rename "search.php", the next time you index, the indexer will try to write out a new copy of "search.php" again. You can set the file to "read only", but this would be a bit of a dirty hack and you might run into other problems in the future when you've forgotten that you've made this file read only.

    Another 'hack' method would be to use something like URL ReWrite to allow "search.php" to be redirected to "mysearch.php".

    But we wouldn't really recommend either of the above, and think that you'd be better off changing the links in your search boxes. It also sounds like you should look into the structure of your site as this is essentially a common web design problem - when you need to change a common element (such as a navigation menu) or link across many files. What would happen if you ever need to change the appearance of the search form, etc? What happens if one of the links on many pages of your site becomes broken (or you simply made a typo?), etc. There are many ways to avoid this (by better structuring your site, the use of applications which support headers/footers library items) as well as mass search-and-replace tools.
    --Ray
    Wrensoft Web Software
    Sydney, Australia
    Zoom Search Engine

    Comment


    • #3
      Thankyou

      Thanks Ray for the full reply to my question . The first hack might be helpful - never thought of making it read only to prevent overwrite , might work - cheers .
      http://www.ad9.co.uk

      Comment


      • #4
        Problem with hack

        I tried changing the search.php permission to read only but it prevents zoom search upload - after timeout get error message from zoom soft saying something like permission needs to be write , so i think this will not work - please let me know if there is anything that can be done to overcome this .

        NB : Error was

        FTP Upload Error
        200 Type Set To I
        200 Port Command Successful
        550: Search.php Permission Denied .

        THanks

        Tony
        http://www.ad9.co.uk

        Comment


        • #5
          why dont u make your search box in 1 file and include that file on the places where u need to have a search box?


          that way u have only 1 code for it and easy to change at 1 place instead of several pages....
          If i think as i thought, i will do as i did and if i do what i did i will think as i thought....

          Comment


          • #6
            THanks

            If by including the search box -i pressume you mean php include thanks for suggestion - its a good one - but too many pages to change - its a good idea for anyone designing a php based site from scratch - but difficult for an established one - Also i prefer not to ftp upload the whole site if possible .

            Ray - please - if you happen to read this thread - please see above topic .
            http://www.ad9.co.uk

            Comment


            • #7
              This is one way

              I think i've a solution , the chmod option is better but could upload to a different directory and then use cron to copy all other files over at certain time - could you list what files are need in the search directory other than search.php

              Thanks
              http://www.ad9.co.uk

              Comment


              • #8
                Re: Problem with hack

                Originally posted by toneharb
                I tried changing the search.php permission to read only but it prevents zoom search upload
                I actually meant setting the "search.php" file in your output directory (ie: on your local computer) to read only, not the one on your web server. So only the Indexer would be unable to write/update the file at the end of indexing (and it would give an error message), but it should continue and allow you to upload the files to your server.

                could you list what files are need in the search directory other than search.php
                This is all the files listed at the end of indexing as "Required files" in the "Indexing Completed" window. There can be additional files if you have certain features enabled (spelling suggestions, categories, etc.) but in essence it is:

                search.php
                settings.php
                search_template.html
                ... and all files with the ZDAT extension (eg. zoom_dictionary.zdat, etc.)

                Note that the above only applies to the PHP version you are using, and they differ for other options such as ASP, Javascript or CGI.
                --Ray
                Wrensoft Web Software
                Sydney, Australia
                Zoom Search Engine

                Comment


                • #9
                  Thanks Ray

                  Silly me was getting too server focused ! Of course didn't think of client end , thanks - excellent level of customer support .

                  Tony
                  http://www.ad9.co.uk

                  Comment


                  • #10
                    (maybe a) bright idea.... make an checkable option that ONLY uploads the zdat files and leaves the scripts as they are.... ?


                    @toneharb
                    i dont know for how many pages it is that the box has to be in
                    but.... i would strongely think about modulizing ur page with php includes more

                    i mean....
                    if u got 1 search box and it comes at 100 pages, then u only have to include 1 file to show that search box and when u need to change something in the search box, u only have to change 1 file and upload it and it is corrected in all pages

                    i realise that with a lot of pages u have now, that it will be a lot fo work, but in the end when ur managers (?) want to change things on the site, it will save u lot of hassle

                    the same u could do for menu's
                    practicly for everything that is not unique on the whole site

                    its just a suggestion
                    its up to you to decide what u rather want

                    in either choice goodluck
                    If i think as i thought, i will do as i did and if i do what i did i will think as i thought....

                    Comment


                    • #11
                      Another suggestion would just be to make the output file name configurable within Zoom's options (i.e. I could tell Zoom to output the file as Blah_Search.php instead of search.php).

                      Comment


                      • #12
                        You could always use a utility such as BK ReplaceEm (http://www.orbit.org/replace/) which can make the changes to your individual pages (not as neat as having it set up so you only need to make one change in future, but can be a way of getting round it once or twice)

                        Comment

                        Working...
                        X