SitePoint Sponsor

User Tag List

Results 1 to 5 of 5

Thread: include problem

  1. #1
    SitePoint Member
    Join Date
    Jun 2011
    Location
    INDIA
    Posts
    18
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Question include problem

    This was really great discussion.
    If you don't mind i too have a question..

    I have a website with .html pages
    now i want to make a banner file and want to include it in all the html pages

    I made the banner in .php format but it is not included in the pages......

    <?php include("banner.php"); ?>

    i used this code and i did this in Dreamweaver any idea about it ???
    Get the best web content and web design for your website.

  2. #2
    From Italy with love silver trophybronze trophy
    guido2004's Avatar
    Join Date
    Sep 2004
    Posts
    9,501
    Mentioned
    163 Post(s)
    Tagged
    4 Thread(s)
    I moved your question to its own thread. If you have questions, don't post them in someone else's threads, but start a new one please. And if your question is related to someone else's, link to that other thread.

  3. #3
    SitePoint Evangelist
    Join Date
    Apr 2009
    Location
    South Carolina
    Posts
    458
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Have you checked to be sure you have PHP available for your site? I expect most web hosting now includes PHP, but that is something to check.

    If you are sure you have PHP, try renaming your index page index.php. Unless you do something via .htaccess, you need to name your pages with the php extension.
    Each day is a learning experience.

  4. #4
    Non-Member
    Join Date
    Apr 2011
    Location
    no fixed address
    Posts
    851
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    PHP Code:
    <?php include("banner.php"); ?>
    The path to the include file should be relative to the folder containing the file the include statement is in.

    Is banner.php in the same folder as the file containing the include statement is in? If not, specify the relative path to banner.php in your include().

    And like CSU-Bill says, your files with php code in them should have a php extension in their file names.

  5. #5
    SitePoint Wizard silver trophybronze trophy Cups's Avatar
    Join Date
    Oct 2006
    Location
    France, deep rural.
    Posts
    6,869
    Mentioned
    17 Post(s)
    Tagged
    1 Thread(s)
    Its pretty easy to test what webdev1958 says, put these 2 files into the same folder.

    banner.php
    PHP Code:
    <?php

    echo "<p>Banner.php says Hello!</p>";

    ?>

    test.php
    PHP Code:
    <p>This is basic html which did not need PHP ...</p>
    <?php

    echo "<p>PHP says Hello!</p>";

    if( include 
    'banner.php' ){

    $include_path ini_get("include_path");
    echo 
    '<p>You could also move banner.php to any of these folders and it should work : ' $include_path '</p>';

    }
    ?>
    Then start up test.php and see what you get.


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •