Yo how do I do a php include thingy?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • juicylinks
    So Fucking Banned
    • Apr 2001
    • 122992

    #1

    Yo how do I do a php include thingy?

    Whats the code for this?

    to include a snippet of juicy shit on evry page?
  • Ice
    Confirmed User
    • Nov 2002
    • 26053

    #2
    Don't ya got a book laying around on that subject guido?
    icq 1904905

    Comment

    • juicylinks
      So Fucking Banned
      • Apr 2001
      • 122992

      #3
      Originally posted by iceicebaby
      Don't ya got a book laying around on that subject guido?
      yeah but i dont read any of them they are too thick and technical for me

      Comment

      • lurking
        Confirmed User
        • Jan 2004
        • 868

        #4
        PHP Code:
        include("file.php"); 
        

        Comment

        • juicylinks
          So Fucking Banned
          • Apr 2001
          • 122992

          #5
          Originally posted by lurking
          PHP Code:
          include("file.php"); 
          
          thanks

          Comment

          • fusionx
            Confirmed User
            • Nov 2003
            • 4618

            #6
            here's the real deal: http://us4.php.net/include/

            and here's the quickie:

            PHP Code:
            <?php include 'http://www.example.com/file.php?foo=1&bar=2'; ?>
            or

            PHP Code:
            <?php include 'file.php?foo=1&bar=2'; ?>
            or

            PHP Code:
            <?php include '/sub/file.php?foo=1&bar=2'; ?>

            Comment

            • juicylinks
              So Fucking Banned
              • Apr 2001
              • 122992

              #7
              edit


              can you use these on .shtml pages?
              Last edited by Juicy D. Links; 04-30-2004, 04:43 PM.

              Comment

              • lurking
                Confirmed User
                • Jan 2004
                • 868

                #8
                Originally posted by juicylinks
                edit


                can you use these on .shtml pages?
                no, that is SSI.

                Comment

                • dirtysouth
                  Confirmed User
                  • Jul 2003
                  • 2613

                  #9
                  also remember to go with the full path ie:
                  PHP Code:
                  <?php include('/home/sites/juicylinks.com/html/juicy.php'); ?>
                  *edit* as opposed to a url.
                  Last edited by dirtysouth; 04-30-2004, 04:54 PM.
                  no sig

                  Comment

                  • WallaceW
                    Confirmed User
                    • Sep 2002
                    • 106

                    #10
                    Originally posted by juicylinks
                    edit


                    can you use these on .shtml pages?
                    Yes, but not by default.

                    There are several ways to do that, but my fav is to make an .htaccess file in the directory where you want your .shtml pages with executable php. In that .htaccess put this:

                    AddType application/x-httpd-php .php .shtml

                    From then your .shtml will be treated as PHP also...

                    Regards
                    Where is my sig?!?

                    Comment

                    • lurking
                      Confirmed User
                      • Jan 2004
                      • 868

                      #11
                      Originally posted by WallaceW
                      Yes, but not by default.

                      There are several ways to do that, but my fav is to make an .htaccess file in the directory where you want your .shtml pages with executable php. In that .htaccess put this:

                      AddType application/x-httpd-php .php .shtml

                      From then your .shtml will be treated as PHP also...

                      Regards
                      keep in mind if the page has a lot of traffic this will put a huge load on the server. it is much wiser to use .php or .phtml

                      Comment

                      • WallaceW
                        Confirmed User
                        • Sep 2002
                        • 106

                        #12
                        Originally posted by lurking
                        keep in mind if the page has a lot of traffic this will put a huge load on the server. it is much wiser to use .php or .phtml
                        Sure. It's just the way if you MUST run php in other then .php files.
                        Where is my sig?!?

                        Comment

                        • lurking
                          Confirmed User
                          • Jan 2004
                          • 868

                          #13
                          also keep in mind it will disable SSI with .shtml

                          Comment

                          • tgp-guru
                            Registered User
                            • Feb 2004
                            • 64

                            #14
                            Use require() instead of include(). If the file to be included is not found require() dies whereas include() gives just an error message. Also with older versions of php (< 4 i think) require would always assume to include the file on compilation whereas include would be subject to runtime conditionals.
                            AIM: johnny b dollars
                            ICQ: 211895983

                            Comment

                            • High Quality
                              Confirmed User
                              • Feb 2002
                              • 5741

                              #15
                              Originally posted by tgp-guru
                              Use require() instead of include(). If the file to be included is not found require() dies whereas include() gives just an error message. Also with older versions of php (< 4 i think) require would always assume to include the file on compilation whereas include would be subject to runtime conditionals.
                              Good point... don't want them surfers knowing you fucked up.

                              RecurCash.com - Averaging $38/sale with 60% revshare in the first 4 months alone!

                              Convert your TEEN traffic today @ better than 1:500 guaranteed. ICQ me: 18287590!

                              Comment

                              Working...