PassMark Logo
Home » Forum

Announcement

Collapse
No announcement yet.

Search Template: Using PHP Includes

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

  • Search Template: Using PHP Includes

    I recently purchased version 5.1 and I'm having a few problems. Can someone please tell me why simple includes won't work with Zoom's search template? ...and what the fix might be.

    example:

    <?php include("footer.inc")?>

    I currently use the above on all of the site's other pages with no problem.

    Thanks

  • #2
    Please see this FAQ:
    Q. How can I add headers & footers to the search template using SSIs or scripts?

    The search template file is not PHP (note that it is named "search_template.html"), so it will not recognize your PHP command. Above FAQ explains in more detail and the recommended method to achieve what you are after.
    --Ray
    Wrensoft Web Software
    Sydney, Australia
    Zoom Search Engine

    Comment


    • #3
      I followed the instructions you offered to the letter. Unfortunately to no avail -- it didn't work. In fact, the website's formatting and any search results disappeared entirely -- showing nothing but a blank page.

      Now after two days working to resolve the problem, I would have asked a programmer buddy to troubleshoot -- but I realised this isn't possible since the data is generated from my machine -- and I'd have to buy an extra copy of Zoom just for him to work a few minutes.

      Anyways, what is your next suggestion?

      Question: If I'm unable to get Zoom working to my satisfaction, may I have a refund?

      Thanks

      Comment


      • #4
        I was confused by the instructions also.

        What you want to do is entirely possible - I'm doing it already.

        You're just doing it the wrong way.

        Are you using the php option?

        Search.php takes parameters - so if you embed search.php in any of your php pages, and pass your page the parameters, search.php will pick it up and display whatever needs to be displayed - using search_template.html to format the results.

        Remember, you don't need to youch search_template.html - it just needs to be in the same directory as search.php

        Comment


        • #5
          Originally posted by zoomology View Post
          I realised this isn't possible since the data is generated from my machine -- and I'd have to buy an extra copy of Zoom just for him to work a few minutes.
          This is not true. Get him to use the free version on a small sample, then pass you a template.

          Comment


          • #6
            Originally posted by zoomology View Post
            I followed the instructions you offered to the letter. Unfortunately to no avail -- it didn't work. In fact, the website's formatting and any search results disappeared entirely -- showing nothing but a blank page.
            This should not happen and suggest that you may have done something wrong. Is your website online, and if so, can you give us the URL to your page? However, this might not be enough for us to spot the problem, if the problem is in your PHP code. If this is the case, you may need to troubleshoot more and provide us with more specific lines of code showing what you have done, and what is happening.

            Originally posted by zoomology View Post
            Now after two days working to resolve the problem, I would have asked a programmer buddy to troubleshoot -- but I realised this isn't possible since the data is generated from my machine -- and I'd have to buy an extra copy of Zoom just for him to work a few minutes.
            As Kendoran mentioned above, this is not true. Your programmer buddy only needs access to your web server, where you have uploaded the search files generated by Zoom, and your PHP pages. He/she should not need to access the Zoom Indexer program to fix this issue.

            Or as kendoran suggested above, he/she could play with the Free Edition and create the custom PHP page you need that embeds your headers and footers.

            Originally posted by zoomology View Post
            Question: If I'm unable to get Zoom working to my satisfaction, may I have a refund?
            We will happily provide refunds if the product does not function as documented, but the above does not appear to be a functional issue from the information you have given us. We (and your programmer friend) should be able to help you get it to work, when applied correctly.
            --Ray
            Wrensoft Web Software
            Sydney, Australia
            Zoom Search Engine

            Comment


            • #7
              I was confused by the instructions also.
              I understand

              What you want to do is entirely possible - I'm doing it already.
              great

              You're just doing it the wrong way.
              okay

              Are you using the php option?
              yes

              Search.php takes parameters - so if you embed search.php in any of your php pages, and pass your page the parameters, search.php will pick it up and display whatever needs to be displayed - using search_template.html to format the results.
              I'm not embedding search.php anywhere on any page. I'm attempting to use an include file in the template for global footers.

              Remember, you don't need to youch search_template.html - it just needs to be in the same directory as search.php
              In the previous paragraph you said that the search_template.html was necessary, but now it's not. That doesn't make sense to me.

              Comment


              • #8
                Originally posted by zoomology View Post
                Originally posted by kendoran View Post
                Search.php takes parameters - so if you embed search.php in any of your php pages, and pass your page the parameters, search.php will pick it up and display whatever needs to be displayed - using search_template.html to format the results.
                I'm not embedding search.php anywhere on any page. I'm attempting to use an include file in the template for global footers.
                Um, the FAQ I linked to above, which you said you have read and followed, states that you need to embed "search.php" in your own PHP page (the example uses "mysearch.php"). It also states that you cannot use a server-side include in the template (i.e. "search_template.html"). This is what Kendoran is referring to.
                --Ray
                Wrensoft Web Software
                Sydney, Australia
                Zoom Search Engine

                Comment


                • #9
                  Hi Raymond,

                  Actually "the code" in question is very simple and straightforward. I basically used a dupe of one the site's pages, added <!--ZOOMSEARCH--> where the results appear, and saved it as search_template.html.

                  Indexing, search function and results display work -- however, my footer and another include file do not display on the results page.

                  Beyond this problem, Zoom doesn't recognize ordinary mod_rewrite rules. But first things first. What do you need to troubleshoot and who should I PM the details to?

                  Thanks

                  Comment


                  • #10
                    Originally posted by Ray View Post
                    Um, the FAQ I linked to above, which you said you have read and followed, states that you need to embed "search.php" in your own PHP page (the example uses "mysearch.php"). It also states that you cannot use a server-side include in the template (i.e. "search_template.html"). This is what Kendoran is referring to.
                    Okay, give me ten minutes or so -- I'll try again.

                    Comment


                    • #11
                      Originally posted by Ray View Post
                      Um, the FAQ I linked to above, which you said you have read and followed, states that you need to embed "search.php" in your own PHP page (the example uses "mysearch.php"). It also states that you cannot use a server-side include in the template (i.e. "search_template.html"). This is what Kendoran is referring to.
                      Ray,

                      I embedded "search.php" in my own PHP page "search_template.php" then made the other changes via the control panel (on my PC), reindexed, uploaded everything again ...and nope it doesn't display the footer file.

                      What do you suggest?

                      Comment


                      • #12
                        Originally posted by zoomology View Post
                        I was confused by the instructions also.
                        I understand
                        Obviously, you don't understand even the basics, otherwise you would have had it working first time like I did.

                        btw, regarding search_template.html, you don't need to reference it in your own code at all - search.php accesses it internally.

                        Comment


                        • #13
                          Originally posted by kendoran View Post
                          Obviously, you don't understand even the basics, otherwise you would have had it working first time like I did.

                          btw, regarding search_template.html, you don't need to reference it in your own code at all - search.php accesses it internally.
                          So, what exactly are you trying to say? I understand 100% that search.php knows to use the HTML template file. I mentioned it only as a reference point.

                          Comment


                          • #14
                            You need some code similar to this (this is exactly what I do, btw):

                            In the page which you want the search box:
                            Code:
                            <form method="get" action="/search-results.php">
                            <input type="text" name="zoom_query" size="20" value="Search"/>
                            <input type="hidden" name="zoom_per_page" value="20" />
                            <input type="hidden" name="zoom_and" value="0" /> 
                            </form>
                            In search-results.php:
                            Code:
                            ... header stuff ...
                            
                            <?php 
                            include("search.php"); 
                            ?>
                            
                            ... footer stuff ...
                            In my case, search_template.html is a blank file in the root directory of my site (same folder as search.php).. it doesn't even contain the <!-- ZOOMWHATEVER --> comment.
                            Last edited by kendoran; Jul-20-2007, 05:03 AM.

                            Comment


                            • #15
                              Originally posted by zoomology View Post
                              Actually "the code" in question is very simple and straightforward. I basically used a dupe of one the site's pages, added <!--ZOOMSEARCH--> where the results appear, and saved it as search_template.html.
                              If the page that you duplicated from contains PHP code (eg. a call to include header and footer), then this will not work. As the FAQ states, the "search_template.html" file will not execute PHP code

                              Originally posted by zoomology View Post
                              I embedded "search.php" in my own PHP page "search_template.php" then made the other changes via the control panel (on my PC), reindexed, uploaded everything again ...and nope it doesn't display the footer file.
                              Are you opening your custom "search_template.php" page in the browser? Or are you still opening "search.php"? You should be doing the former to see the result of your changes. The behaviour of "search.php" would not have changed.

                              This is why we suggested a filename of "mysearch.php" in our example, for the custom page, as opposed to "search_template.php" (which you are using - and thus is confusing). The custom PHP search page you created is not supposed to work like a replacement for "search_template.html", if this is what you are thinking.
                              Last edited by Ray; Jul-20-2007, 05:48 AM.
                              --Ray
                              Wrensoft Web Software
                              Sydney, Australia
                              Zoom Search Engine

                              Comment

                              Working...
                              X