Results 1 to 5 of 5

Thread: Test For Php Includes

  1. #1
    Join Date
    Nov 2006
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Test For Php Includes

    I am having a few problems trying to get my php includes showing on my page.

    Is there any easy/basic code I can insert on a page to test whether it is really working. The package I get from my host does allow php includes so there shouldn't be a problem there?

  2. #2
    Join Date
    Aug 2005
    Location
    Other Side of My Monitor
    Posts
    3,494
    Thanks
    5
    Thanked 105 Times in 104 Posts
    Blog Entries
    1

    Default

    Are you inserting the php code in an HTML page? (.htm or .html extension)

    If so you need to set up the .htaccess to read html as php.
    {CWoT - Riddle } {Freelance Copywriter} {Learn to Write}
    Follow Me on Twitter: @InkingHubris
    PHP Code:
    $result mysql_query("SELECT finger FROM hand WHERE id=3");
    echo 
    $result

  3. #3
    Join Date
    Nov 2006
    Posts
    99
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Not real sure if you meant a basic snippet of an include tag but here is what it should look like.
    PHP Code:
    <?php  include("PATH/TO/FILE.php");
     
    ?>
    Good Luck!

  4. #4
    Join Date
    Sep 2006
    Location
    St. George, UT
    Posts
    2,769
    Thanks
    3
    Thanked 157 Times in 155 Posts

    Default

    Something else to take into consideration, are you trying to include a plain text page, or another PHP file. If including another PHP page, does that page echo any text at all? If it doesn't and you want to see if it is working at all, make a php file echo some text and try that. Hope this helps a little.
    "Computer games don't affect kids; I mean if Pac-Man affected us as kids, we'd all be running around in darkened rooms, munching magic pills and listening to repetitive electronic music." - Kristian Wilson, Nintendo, Inc, 1989
    TheUnlimitedHost | The Testing Site | Southern Utah Web Hosting and Design

  5. #5
    Join Date
    Mar 2006
    Location
    Illinois, USA
    Posts
    12,164
    Thanks
    265
    Thanked 690 Times in 678 Posts

    Default

    Make two files-- test.php and test.htm

    test.htm:
    Code:
    it works
    test.php:
    Code:
    <?php include('test.htm'); ?>
    Run test.php

    Also, assuming (or to check if) php is installed on your server, run this to check all the various settings and such--
    Code:
    <?php phpinfo(); ?>
    That's it. It'll generate a very long html page with tons of values... but for now just notice things like if safe mode is enabled, what version you have, what the server environment is like, etc.
    Daniel - Freelance Web Design | <?php?> | <html>| español | Deutsch | italiano | português | català | un peu de français | some knowledge of several other languages: I can sometimes help translate here on DD | Linguistics Forum

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
  •