SitePoint Sponsor

User Tag List

Results 1 to 6 of 6

Thread: Help please

  1. #1
    SitePoint Enthusiast
    Join Date
    Jul 2001
    Location
    United Kingdom
    Posts
    31
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Help please

    I've been learning php recently, but I'd still consider myself to be a newbie to it.

    I'm switching from using cgi, and plain old html, but my concern with php is including files (as with ssi). Is this possible with php, or is there an alternative, and if so, how do you do it?

    Any help is greatly appreciated, thanks.
    No one is a virgin, life screws us all

  2. #2
    SitePoint Enthusiast Stallion's Avatar
    Join Date
    Jan 2001
    Location
    Cumberland, RI, US
    Posts
    97
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

  3. #3
    SitePoint Enthusiast
    Join Date
    Jul 2001
    Location
    United Kingdom
    Posts
    31
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thanks, it seems a little confusing still, but I'm sure I'll get the hang of it.
    No one is a virgin, life screws us all

  4. #4
    SitePoint Enthusiast Stallion's Avatar
    Join Date
    Jan 2001
    Location
    Cumberland, RI, US
    Posts
    97
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    To use them like you would use most SSI:

    <?require("/home/sitepoint.com/htdocs/includes/navigation.inc")?>

  5. #5
    SitePoint Addict Shantra's Avatar
    Join Date
    Feb 2001
    Location
    Norway
    Posts
    224
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    There is many great ways to include files!

    main.php:
    // Here you will include a file
    <html>
    My name is <?php include('filename.inc'); ?>
    </html>

    filename.inc:
    Long John

    Output:
    My name is Long John

    Another way is to use a echo command.

    main.php:
    // Here you will include a config file
    <?php include('config.inc'); ?>
    <html>
    <head>
    <body bgcolor="<?php echo $bgcolor; ?>">
    </head>
    You can change the bgcolor remotely by the config file.
    </html>

    config.inc:
    <?php
    $bgcolor = "#990000";
    ?>


    Hope that this helps!

  6. #6
    SitePoint Enthusiast
    Join Date
    Jul 2001
    Location
    United Kingdom
    Posts
    31
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thanks, I've ended up up just using the include statement.
    No one is a virgin, life screws us all


Bookmarks

Posting Permissions

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