I want an introduction to appear only on the homepage

Discussion in 'PHP' started by jeeremie, Jul 23, 2007.

  1. #1
    Hello,

    I am using a simple online commerce system and I need to have an introduction (image+text) that will only appear on the home page (see http://www.phpwebcommerce.com/plaincart/index.php).

    I already created a file called intro.php:

    <?php
    if (!defined('WEB_ROOT')) {
    	exit;
    }
    ?>
    
    
    			<h1>Handmade Dolls <span>for Key-Ring by Ann</span></h1>
    			<div class="text">
    				<img class="center" src="images/intro.jpg" />
    				<big class="center">Welcome to Hailstorm Design!</big>
    			</div>
    			<!--Intro-->
    Code (markup):


    Any ideas?

    Thanks in advance.
     
    jeeremie, Jul 23, 2007 IP
  2. nico_swd

    nico_swd Prominent Member

    Messages:
    4,153
    Likes Received:
    344
    Best Answers:
    18
    Trophy Points:
    375
    #2
    
    
    if (basename($_SERVER['PHP_SELF']) == 'index.php')
    {
        include 'intro.php';
    }
    
    PHP:
    ??
     
    nico_swd, Jul 23, 2007 IP
  3. jeeremie

    jeeremie Peon

    Messages:
    2
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #3
    Thanks for your support.

    It works but not exactly as I want. The thing is I have the categories on the homepage as well. When I select a categorie, it loads the products on the same page (index.php). But I don't want to have the Intro and the products on the same page. I would be too busy. But I want the intro to be with the categories (hmmm, I hope i am not asking too much!).

    Here is the index.php:

    <?php
    require_once 'library/config.php';
    require_once 'library/category-functions.php';
    require_once 'library/product-functions.php';
    require_once 'library/cart-functions.php';
    
    $_SESSION['shop_return_url'] = $_SERVER['REQUEST_URI'];
    
    $catId  = (isset($_GET['c']) && $_GET['c'] != '1') ? $_GET['c'] : 0;
    $pdId   = (isset($_GET['p']) && $_GET['p'] != '') ? $_GET['p'] : 0;
    
    require_once 'include/header.php';
    ?>
    
      <?php require_once 'include/top.php'; ?>
     
      <?php require_once 'include/leftNav.php'; ?>
     
            <div id="content">             
             <div class="text">
    
                                    <!--******-->
                                    <!--I need to add the intro here!-->
                                    <h1>Handmade Dolls <span>for Key-Ring by Ann</span></h1>
                      <div class="text">
                        <img class="center" src="images/intro.jpg" />
                        <big class="center">Welcome to Hailstorm Design!</big>
                     </div>
             <!--Intro-->
                                    <!--******-->
    
                <!-- ... and now the script generating the categories and products related-->
                <?php
                if ($pdId) {
                   require_once 'include/productDetail.php';
                } else if ($catId) {
                   require_once 'include/productList.php';
                } else {
                   require_once 'include/categoryList.php';
                }
                ?> 
             </div>      
          </div>
          <!--/Content-->
       
       
     
      <?php require_once 'include/rightNav.php'; ?>
     
      <?php require_once 'include/footer.php'; ?> 
    Code (markup):
    I hope this helps.
     
    jeeremie, Jul 24, 2007 IP