+ Reply to Thread
Results 1 to 7 of 7

Thread: Including Files With PHP

  1. #1
    sk1tL1L is offline x10Hosting Member sk1tL1L is an unknown quantity at this point
    Join Date
    Aug 2006
    Posts
    59

    Smile Including Files With PHP

    Very Simple, but some people do not know how to do it.
    Ok if i had header.php and footer.php. Insted of Puting "Third Floor programming" on the top of everypage and "Copyright" On the bottem. I Can Type into a php document:
    PHP Code:
    <?php include 'header.php'?>
    So on Index.php it will show the header. You can do it on everypage. And you only have to change the one file to change the header of ALL the pages you but the code on. Eg.
    PHP Code:
    <?php include 'header.php'?>
    <b>Welcome</b> To my site!.
    <?php include 'footer.php'?>
    Simple?
    I Think So

    ---
    sk1tL1L
    http://thirdfloor.x10hosting.com
    Soon to be: http://thirdfloorprogramming.com

  2. #2
    Fedlerner's Avatar
    Fedlerner is offline Retired Fedlerner is an unknown quantity at this point
    Join Date
    Aug 2006
    Location
    Buenos Aires, Argentina
    Posts
    12,923

    Re: Including Files With PHP

    Yes, simple but usefull.
    I knew this but i know very little of PHP :D

    Thanks man!
    fedlerner
    Federico Lerner
    Former x10Hosting Administrator - Staff Manager

  3. #3
    gaspardan is offline x10Hosting Member gaspardan is an unknown quantity at this point
    Join Date
    Sep 2006
    Posts
    1

    Re: Including Files With PHP

    except using imagem - to include images in some place your fule use the script for image and after include this file in your principal file.php

    INCLUDE ("fileimage.txt").

    Right? Daniel


  4. #4
    unpixelatedgamers's Avatar
    unpixelatedgamers is offline x10 Lieutenant unpixelatedgamers is an unknown quantity at this point
    Join Date
    Sep 2005
    Location
    Nottingham (England)
    Posts
    337

    Re: Including Files With PHP

    for those reading this tutorial, you can include different types of file, ie, .txt or .html if you prefer The includes don't have to be .php, only the file you are including them to.

    Just in case someone wasn't sure about that.
    Ignorance is the true enemy of all things.

  5. #5
    blacklion524 is offline x10Hosting Member blacklion524 is an unknown quantity at this point
    Join Date
    Aug 2006
    Posts
    16

    Re: Including Files With PHP

    Heres my dilema. My site (www.dead2world.com) has a flash header with a forums tab. So when user click on it they get a phpbb board with my website skin. What i wanted to know is if i can make my flash header appear on my forums instead of the static html one.

  6. #6
    Bingo is offline x10Hosting Member Bingo is an unknown quantity at this point
    Join Date
    Sep 2006
    Posts
    2

    Re: Including Files With PHP

    In most cases, include is all you need, but I was writing a very complex web app for a job and the require_once command is very useful in some situations. It is implemented the same way. It is useful if you have a header file that you need for a ton of different php files because it only includes the header once.
    It's also useful for hack jobs that haven't been well organized :-\

  7. #7
    yahia is offline x10 Sophmore yahia is an unknown quantity at this point
    Join Date
    Jul 2006
    Location
    Morocco
    Posts
    169

    Re: Including Files With PHP

    I do require() instead of include().
    I remember Idid it because include() didn't xant to work on the 1st server.
    I dunno if it works now, but I won't be going to change all my pages from require() to include()

    Is this a problem or it's okay?

+ Reply to Thread

Similar Threads

  1. [PHP] Variables in PHP
    By Bryon in forum Tutorials
    Replies: 15
    Last Post: 01-29-2009, 09:46 AM
  2. tons of PHP Resources
    By Chris S in forum Scripts & 3rd Party Apps
    Replies: 10
    Last Post: 01-16-2009, 10:07 AM
  3. Unstand PHP?
    By o0slowpaul0o in forum Tutorials
    Replies: 8
    Last Post: 01-07-2008, 09:16 PM
  4. I need php code for downloading zip files from my site !!
    By careerbridge in forum Scripts & 3rd Party Apps
    Replies: 11
    Last Post: 07-16-2006, 12:57 PM
  5. php files wont work
    By brentcatoe in forum Free Hosting
    Replies: 1
    Last Post: 09-22-2005, 10:50 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
x10hosting free hosting for the masses
dedicated servers