Default SSI help -->Creating a seperate Index page ?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • DigitalDrew
    New Member
    • May 2009
    • 2

    Default SSI help -->Creating a seperate Index page ?

    Just wanted to say hello to all the other newbies, and ask my first question:
    Your help is extremely needed, and I would appreciate anyone who can help.

    I am trying to make a website with SSI (server side includes), so my site doesn't take years to load.

    Here is my html and <?php ?> function:

    Code:
    <body>
    <div id="container">
    
    <?php include_once('includes/search.php');?>
    <?php include_once('includes/tabs.php');?>
    <?php include_once('includes/menu.php');?>
    
    
    <div id="content">
    
    
    <?php
    
    include_once('includes/mission_statement.php');
    
    include_once('includes/framed_gallery.php');
    
    if($_GET['page'])
    {
    
    include('pages/' . $_GET['page'] . '.php');
    
    }
    else
    {
    include('pages/home.php');
    }
    
    
    ?>
    
    
    </div>
    <?php include_once('includes/footer.php');?>
    
    </div>
    
    
    </body>
    </html>


    Here is my menu:
    Code:
    <div id="side_bar_menu">
    
    
    <div class="glossymenu">
    <a class="menuitem_home" href="http://bytes.com/community/greenfield" ></a>
    
    <a class="menuitem_about submenuheader" href"../greenfield/home.php?page=Welcome"> </a>
    <div class="submenu">
    <ul>
    <li><a href="http://bytes.com/community/greenfield/home.php?page=Welcome">Welcome</a></li>
    <li><a href="http://bytes.com/community/greenfield/home.php?page=Community">Our Community</a></li>
    <li><a href="http://bytes.com/community/greenfield/home.php?page=Common">Commom Experiences</a></li>
    <li><a href="http://bytes.com/community/greenfield/home.php?page=Expectations">Expectations of Students</a></li>
    </ul>
    </div>

    What I don't understand is how I can get ONLY the index page to show these:

    include_once('i ncludes/mission_stateme nt.php');

    include_once('i ncludes/framed_gallery. php');


    with out it having to stay on every page there after...???

    Thanks in advance,
    Digital Drew
    Last edited by Markus; May 15 '09, 12:16 PM. Reason: Added [code] tags.
  • Ciary
    Recognized Expert New Member
    • Apr 2009
    • 247

    #2
    first of all, welcome on the forum.

    /* second: php is a server side script. so all lines of php are processed by the server before it send the page to the browser, any lines of php (like include-once) aren't shown in the sourcecode. instead, your browser will still receive the full html code send by the server. so ssi isn't a way to make your page load faster. */

    last: consider using code-tags in your posts on the forum. it makes your code easier to be read.

    /*a tip: if you want to hide your code in sourcecode: use javascript/ajax to load your page. your html will still be visible in firebug though */

    EDIT: srr i think i misunderstood your question:

    try this:
    Code:
    if($_SERVER['PHP_SELF']=="index.php"){
    put it around the lines you only want to show on index.php
    Last edited by Ciary; May 15 '09, 11:01 AM. Reason: misunderstood the question

    Comment

    • prabirchoudhury
      New Member
      • May 2009
      • 162

      #3
      Creating a seperate Index page

      1. you call all the different pages just frm the index.php page and stay there..

      call your described pas as index.php page. make three part of ther page
      a. header part : cinstant header part

      b content part : would be dinamic body part and this part would call the different function according to request.

      c. footer part: constant footer part



      Code:
      <HTML>
      <body>
      <!-- start header part -->
      <div id="container">
      
      <?php include_once('includes/search.php');?>
      <?php include_once('includes/tabs.php');?>
      <?php include_once('includes/menu.php');?>
      
      <!-- end header part -->
      
      
      <!-- start content part -->
      <div id="content">
      
      
      <?php
      
      include_once('includes/mission_statement.php');
      
      include_once('includes/framed_gallery.php');
      
      if($_GET['page'])
      {
      
      include('pages/' . $_GET['page'] . '.php');
      
      }
      else
      {
      include('pages/home.php');
      }
      
      
      ?>
      </div>
      <!-- end content  part -->
      <!-- start footer part -->
      <?php include_once('includes/footer.php');?>
      
      </div>
      
      
      </body>
      </html>

      Comment

      • Markus
        Recognized Expert Expert
        • Jun 2007
        • 6092

        #4
        For further reading, check out the MVC architecture (design pattern). Mixing your PHP (read: not server-side-includes) with your HTML (presentation) is generally a bad idea.

        Comment

        • DigitalDrew
          New Member
          • May 2009
          • 2

          #5
          Thanks to every one's prompt answers:
          [B]Ciary:[B] Your edit was correct, and I'm going to try the
          # if($_SERVER['PHP_SELF']=="index.php" ){
          tomorrow when I get a chance.

          and

          [B]Markus:[B] Thanks, I went to the MVC link you provided and I tried 2 frameworks before I stuck with CodeIgnitor, seems easy to follow and being more of a designer than a developer, it will absolutely work perfectly with my workflow in contrast to using simple PHP scripts here and there.

          Thanks again!

          DigitalDrew

          Comment

          Working...