Include Function

Discussion in 'Programming' started by paradox, Feb 20, 2009.

  1. #1
    I'm a php challenged person but am required to "include" a php script/file into another php page.

    Haveing searched around I have seen several ways to do an include () function but many seem old? or more complex than needed for just a simple include.

    Would this code below work to include the abcd.php file/script into an existing php page?

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

    TIA
     
    paradox, Feb 20, 2009 IP
  2. the-webber

    the-webber Peon

    Messages:
    12
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #2
    that code will work provided that the file calling the script is inside the same directory as 'abcd.php'
     
    the-webber, Feb 20, 2009 IP
  3. thefluffball

    thefluffball Peon

    Messages:
    61
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #3
    Otherwise, I would recommend using an absolute server path.
     
    thefluffball, Feb 20, 2009 IP
  4. paradox

    paradox Well-Known Member

    Messages:
    116
    Likes Received:
    3
    Best Answers:
    0
    Trophy Points:
    103
    #4
    Thank a lot - just what i needed to know
     
    paradox, Feb 20, 2009 IP
  5. dooma

    dooma Well-Known Member

    Messages:
    205
    Likes Received:
    5
    Best Answers:
    0
    Trophy Points:
    130
    #5
    code may work provided which file calling the script inside the same directory
     
    dooma, Feb 20, 2009 IP