Include a file on every single page

Discussion in 'PHP' started by lruneh, Feb 15, 2009.

  1. #1
    Hi all

    I'm familiar with using
    include("dir/file.php");
    PHP:
    , but what I want to ask is this:
    Is there a way to include one specific inclue file on every single php page without adding the code in avery single php file?

    Originally, I was thinking that .htaccess might be the way to go, but no. So is this possible, or should I just get copy/pasting?

    THanks
     
    lruneh, Feb 15, 2009 IP
  2. ActiveFrost

    ActiveFrost Notable Member

    Messages:
    2,072
    Likes Received:
    63
    Best Answers:
    3
    Trophy Points:
    245
    #2
    It's not possible ! You need to add include or require function on every single page where you need it.
     
    ActiveFrost, Feb 15, 2009 IP
  3. lruneh

    lruneh Peon

    Messages:
    72
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #3
    Dang it! But thank you for your reply ActiveFrost. I don't suppose that there is any other language that together with php would accomplish what I'm after?
     
    lruneh, Feb 15, 2009 IP
  4. rohan_shenoy

    rohan_shenoy Active Member

    Messages:
    441
    Likes Received:
    20
    Best Answers:
    0
    Trophy Points:
    60
    #4
    Yes, there is a way. Whether its useful to you or not depends upon what you want to do with it.

    Google for "php_auto_prepend". You can either set it through PHP.ini file or a htaccess directive.

    EDIT: I had typed "php_auto_append" earlier in mistake. It should be "php_auto_prepend"!
     
    rohan_shenoy, Feb 15, 2009 IP
  5. joebert

    joebert Well-Known Member

    Messages:
    2,150
    Likes Received:
    88
    Best Answers:
    0
    Trophy Points:
    145