PassMark Logo
Home » Forum

Announcement

Collapse
No announcement yet.

PHP includes not showing up in search_template.html

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

  • PHP includes not showing up in search_template.html

    Hey,

    Having some difficulties with including SSI into the search_template.html page.

    All my php includes are not showing up in the results page.

    The code for the search_template.html is below, i did internal stylesheets to it still styles it the way i need. Its just that my php includes do not show up.

    <?php
    session_start();
    ?>
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
    <meta http-equiv="content-type" content="text/xml; charset=utf-8" />
    <title>The Floral Boutique | Search Results</title>
    <link rel="stylesheet" type="text/css" href="divstyle.css" />
    <link rel="stylesheet" type="text/css" href="formatstyles.css" />

    </head>
    <body onload="if (document.getElementById('zoom_searchbox')) {document.getElementById('zoom_searchbox').focus() ;}">

    <div id="container">
    <div id="banner">
    <?php include("banner.php"); ?>
    </div>
    <div id="top_navigation">
    <?php include("top_menu.php"); ?>
    </div>
    <div id="top_navigationline">&nbsp;</div>
    <div id="navigation">
    <?php include("left_menu.php"); ?>
    </div>
    <div id="content">
    <h1 class="title">Search Results</h1>

    <!--ZOOMSEARCH-->

    </div>
    <div id="footer">
    <?php include("footer.php"); ?>
    </div>
    </div>
    </body>
    </html>


    Thanks in advanced, if you could get back to me asap it would be great.

    Can be tested here:
    http://freddo.bf.rmit.edu.au/~s3233554/floral/index.html

    Search for vase and click submit..

  • #2
    You can't put PHP code into the template file.

    You need to use the method in this FAQ instead.
    Q. How can I add headers & footers to the search template using server side includes (SSIs) or scripts?

    Comment


    • #3
      Originally posted by wrensoft View Post
      You can't put PHP code into the template file.

      You need to use the method in this FAQ instead.
      Q. How can I add headers & footers to the search template using server side includes (SSIs) or scripts?
      I dont understand the instructions in that page, have read it.

      Could you explain further for me? or do it if you have the time.
      Been trying it for a little while with no luck

      Comment


      • #4
        What bit don't you understand?

        If you are already coding in PHP then the FAQ page should make perfect sense. I am not sure what else needs explaining further.

        Comment


        • #5
          Originally posted by wrensoft View Post
          What bit don't you understand?

          If you are already coding in PHP then the FAQ page should make perfect sense. I am not sure what else needs explaining further.
          Well i don't understand how it gets to mysearch.php after clicking submit...

          Current Code in mysearch.php
          PHP Code:
          <?php
              session_start
          ();
          ?>
          <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
             "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
          <html xmlns="http://www.w3.org/1999/xhtml">
              <head>
                  <meta http-equiv="content-type" content="text/xml; charset=utf-8" />
                  <title>The Floral Boutique | About Us</title>
                  <link rel="stylesheet" type="text/css" href="divstyle.css" />
                  <link rel="stylesheet" type="text/css" href="formatstyles.css" />

              </head>
              <body onload="if (document.getElementById('zoom_searchbox')) {document.getElementById('zoom_searchbox').focus();}">

                  <div id="container">
                      <div id="banner">
                          <?php include("banner.php"); ?>
                      </div>
                      <div id="top_navigation">
                          <?php include("top_menu.php"); ?>
                      </div>
                      <div id="top_navigationline">&nbsp;</div>
                      <div id="navigation">
                          <?php include("left_menu.php"); ?>
                      </div>
                      <div id="content">
                          <h1 class="title">Searc Results</h1>
                          <!--ZOOMSEARCH-->
                      </div>
                      <div id="footer">
                          <?php include("footer.php"); ?>
                      </div>
                  </div>
              </body>
          </html>
          Current Code in search_template.html
          Code:
          <?php include("mysearch.php"); ?>
          What am i doing wrong?

          Comment


          • #6
            As already stated, you can't put PHP code in the search_template.html file.

            And as stated in the FAQ, your mysearch.php file need to contain a line like,
            <?php virtual("search.php"); ?>

            Comment


            • #7
              Originally posted by wrensoft View Post
              As already stated, you can't put PHP code in the search_template.html file.

              And as stated in the FAQ, your mysearch.php file need to contain a line like,
              <?php virtual("search.php"); ?>

              Please read the FAQ linked above.
              All my PHP is in the "mysearch.php" file.

              I don't understand how i get the results to display on the page with PHP, what do i need to put so that instead of going to search_template.php it will go to my "mysearch.php"

              Comment


              • #8
                You said this,

                Current Code in search_template.html
                Code:
                <?php include("mysearch.php"); ?>
                Then contradicted yourself with this,
                All my PHP is in the "mysearch.php" file.
                So I don't really know what you have in what files.

                ...what do i need to put so that instead of going to search_template.php
                We don't supply, nor suggest creating, any file called search_template.php. So I don't where this file came from.

                Maybe start again from the beginning with the files we supply and carefully follow the FAQ.

                Comment


                • #9
                  Originally posted by wrensoft View Post
                  You said this,



                  Then contradicted yourself with this,


                  So I don't really know what you have in what files.



                  We don't supply, nor suggest creating, any file called search_template.php. So I don't where this file came from.

                  Maybe start again from the beginning with the files we supply and carefully follow the FAQ.
                  Sorry i meant search_template.html.

                  Code in search_template.php
                  Code:
                  <?php virtual("mysearch.php"); ?>
                  <!--ZOOMSEARCH-->
                  Code in mysearch.php
                  PHP Code:
                  <?php
                      session_start
                  ();
                  ?>
                  <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
                     "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
                  <html xmlns="http://www.w3.org/1999/xhtml">
                      <head>
                          <meta http-equiv="content-type" content="text/xml; charset=utf-8" />
                          <title>The Floral Boutique | About Us</title>
                          <link rel="stylesheet" type="text/css" href="divstyle.css" />
                          <link rel="stylesheet" type="text/css" href="formatstyles.css" />

                      </head>
                      <body onload="if (document.getElementById('zoom_searchbox')) {document.getElementById('zoom_searchbox').focus();}">

                          <div id="container">
                              <div id="banner">
                                  <?php include("banner.php"); ?>
                              </div>
                              <div id="top_navigation">
                                  <?php include("top_menu.php"); ?>
                              </div>
                              <div id="top_navigationline">&nbsp;</div>
                              <div id="navigation">
                                  <?php include("left_menu.php"); ?>
                              </div>
                              <div id="content">
                                  <?php virtual("search.php"); ?>
                                  
                              </div>
                              <div id="footer">
                                  <?php include("footer.php"); ?>
                              </div>
                          </div>
                      </body>
                  </html>
                  Ok well there is some PHP code in search_template.html, but i dont understand how my layout will show up with no data in search_template.html.

                  That was my question from the start.
                  Could you please help me,

                  Comment


                  • #10
                    At the moment all i can get is my Layout all done, but the search results come out right at the bottom underneath the footer, this is really frustrating.

                    Comment


                    • #11
                      So.. any idea what im doing wrong?

                      Comment


                      • #12
                        Ok well there is some PHP code in search_template.html
                        Remove it. You can't have PHP in the search_template.html file.

                        Can be tested here:
                        http://freddo.bf.rmit.edu.au/~s3233554/floral/index.html
                        Search for vase and click submit..
                        I just get a 404 page not found error. This means the URL in your search form isn't pointing to the search script. I can't tell you what the URL should be as I don't know where you have uploaded all the files on your site.

                        Comment


                        • #13
                          Ok removed.

                          Sorry mate try this link.

                          http://freddo.bf.rmit.edu.au/~s3198941/Assignment2/Website/index.html

                          Comment


                          • #14
                            So now when I do a search I see search results, with a header and a footer (i.e. I don't see the problem). I don't see the footer above the results, as you described.

                            Comment


                            • #15
                              The banner, left menu and footer isnt comin up properly. The actual php includes arent appearing, only css stuff atm is showing up.

                              If you look on other pages youll see what should be should be showing up.

                              Thanks

                              Comment

                              Working...
                              X