User Tag List

Results 1 to 5 of 5

Thread: Include a php file once?

  1. #1
    Admin of this place. Opie's Avatar
    Join Date
    Dec 2001
    Location
    LA
    Age
    35
    Posts
    14,424
    Points
    926 (0 Banked)

    Include a php file once?

    I'm old school as some of you know, but wondering if there is any way to include an image or page to display just on the homepage. My code is dynamic on the main page so I'm having issues. The require_once or whatever it is hasn't worked, so I'm stumped.

    Any help i suck yo dick

  2. #2
    Entensity Vet BAM720's Avatar
    Join Date
    Feb 2007
    Location
    Colorado
    Age
    33
    Posts
    3,252
    Points
    61 (1,272,814 Banked)
    you can do a simple check in $_SERVER['REQUEST_URI'] to see if it matches '/' or 'index.php' then inside the if just do your include_once or require_once

  3. #3
    Admin of this place. Opie's Avatar
    Join Date
    Dec 2001
    Location
    LA
    Age
    35
    Posts
    14,424
    Points
    926 (0 Banked)
    how do I go about doing that.

    I tried include and require once and it still pops up on every page

  4. #4
    Eye Candy Robot Nix's Avatar
    Entense Supporter
    Join Date
    Feb 2007
    Location
    In Your Mind
    Posts
    33,477
    Points
    9 (5,102,256 Banked)
    Oh.

    That's not how that works.

    Require will stop the page from outputting unless that file is present.

    Include will continue but throw errors.

    If you just want something to show up ONLY on the main page then I am assuming based on the way your links work:

    Code:
    if (!isset($_GET['content']) && empty($_GET['content'])) {
       echo 'WHATEVER';
    }

  5. #5
    Admin of this place. Opie's Avatar
    Join Date
    Dec 2001
    Location
    LA
    Age
    35
    Posts
    14,424
    Points
    926 (0 Banked)
    that worked, thanks!

Posting Permissions

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