+ Reply to Thread
Results 1 to 4 of 4

Thread: PHP text script

  1. #1
    mikel2k3 is offline x10 Lieutenant mikel2k3 is an unknown quantity at this point
    Join Date
    Aug 2005
    Location
    West Yorkshire - UK
    Posts
    374

    PHP text script

    Hey,
    Im just wondering if there is a script that will read the text from a normal .txt file, and then insert it somewhere on a normal .html page?

    Ive looked around for it and cant really find one. It seems like a simple thing, so if anybody could find/write one that would be rgeat.

    Thanks,
    Mike
    -----------------------------------
    -----------------------------------

    http://www.DistrasDesigns.com

    -----------------------------------
    -----------------------------------

  2. #2
    Chris Z's Avatar
    Chris Z is offline x10 Spammer Chris Z is an unknown quantity at this point
    Join Date
    Sep 2005
    Location
    Alabama, USA
    Posts
    2,802

    Re: PHP text script

    This should work:
    PHP Code:
    <?php
    $file 
    'path/to/file/here.php';
    include(
    $file);
    ?>
    Last edited by Chris Z; 06-30-2007 at 11:04 AM.
    -Chris Z
    Retired Account Manager


  3. #3
    mikel2k3 is offline x10 Lieutenant mikel2k3 is an unknown quantity at this point
    Join Date
    Aug 2005
    Location
    West Yorkshire - UK
    Posts
    374

    Re: PHP text script

    hmm, that didnt work.

    Any other idea's?
    -----------------------------------
    -----------------------------------

    http://www.DistrasDesigns.com

    -----------------------------------
    -----------------------------------

  4. #4
    CascadesAdmin is offline x10Hosting Member CascadesAdmin is an unknown quantity at this point
    Join Date
    Jun 2007
    Posts
    87

    Re: PHP text script

    try this:

    PHP Code:
    <?php include("filename.txt"); ?>
    <h1>Welcome to my home page</h1>
    <p>Some text</p>
    </body>
    </html>
    or try

    PHP Code:
    <html>
    <body>
    <?php
    $file
    =fopen("welcome.txt","r") or exit("Unable to open file!");

    // Tells when The File has reached the end. You can remove
    if (feof($file)) echo "End of file"

    ?>
    </body>
    </html>
    Last edited by CascadesAdmin; 07-06-2007 at 09:33 AM.

+ Reply to Thread

Similar Threads

  1. [PHP] Variables in PHP
    By Bryon in forum Tutorials
    Replies: 15
    Last Post: 01-29-2009, 09:46 AM
  2. [PHP] PHP For Starters
    By Complex in forum Tutorials
    Replies: 24
    Last Post: 06-14-2008, 11:40 PM
  3. Unstand PHP?
    By o0slowpaul0o in forum Tutorials
    Replies: 8
    Last Post: 01-07-2008, 09:16 PM
  4. "PHP Startup: Invalid Library" - Interesting error
    By javaguy78 in forum Free Hosting
    Replies: 5
    Last Post: 03-27-2007, 02:33 PM
  5. Need help with PHP script
    By cyberxzt in forum Scripts & 3rd Party Apps
    Replies: 3
    Last Post: 01-06-2007, 01:43 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
x10hosting free hosting for the masses
dedicated servers