Register

If this is your first visit, please click the Sign Up now button to begin the process of creating your account so you can begin posting on our forums! The Sign Up process will only take up about a minute of two of your time.

Results 1 to 8 of 8
  1. #1
    Senior Member kirman's Avatar
    Join Date
    May 2003
    Location
    UK England
    Posts
    765
    Member #
    1499
    Liked
    2 times
    Ok so i have a news feed section on my webpage. Rather than me updating this every day, is it possible for me to have a text file which the owner can update... and then it is included where i put the news?

    Or is there an even easier way of doing this lol

    Cheers oppos!
    Dream like you'll live forever. Live like you're gonna die 2morrow!

  2.  

  3. #2
    Senior Member Webzarus's Avatar
    Join Date
    May 2011
    Location
    South Carolina Coast
    Posts
    3,322
    Member #
    27709
    Liked
    770 times
    This what the other thread is about ? I'm readin backward trying to catch up ?

  4. #3
    Senior Member kirman's Avatar
    Join Date
    May 2003
    Location
    UK England
    Posts
    765
    Member #
    1499
    Liked
    2 times
    So i made a text file and added <?php include 'testfile.txt';?> to a page and it worked! everything was formatted just as i wanted.

    However when i put this into my already made page... it goes mental and doesnt display any images or anything just plain text that isnt formatted... any ideas? Cheers...

    PHP Code:
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
    <title>Untitled Document</title>
    </head>

    <body><span style="border-bottom:thick #333366;">HIIIIIIIIIIIIIIIIIIIIIII</span>
    <div style="width:330px; height:300px; font-family:Verdana, Arial, Helvetica, sans-serif; font-size:18px">
    <?php include 'testfile.txt';?>
    </div>
    </body>
    </html>
    Dream like you'll live forever. Live like you're gonna die 2morrow!

  5. #4
    Senior Member Webzarus's Avatar
    Join Date
    May 2011
    Location
    South Carolina Coast
    Posts
    3,322
    Member #
    27709
    Liked
    770 times
    What you wrote doesn't make sense.

    The first paragraph says it works... "included the text file and it works" ?

    The second paragraph mentions images, but I see no rferences to images in the code that you posted ?

    The only thing I can think of ( without seeing the code for the included .txt file ) is that you are actually using HTML in the .txt File.

    That works with .asp includeds... Never tried in in php, but my understanding is with php, the include is a directive to tell the processor how to process the include. So if you have HTML in the include file, then the include and the file should be named .html.

    I only use the .txt file and include If the contents of the file is actually only text.

    If I'm wrong in understanding, plead post the code of the include file as well.

  6. #5
    Senior Member kirman's Avatar
    Join Date
    May 2003
    Location
    UK England
    Posts
    765
    Member #
    1499
    Liked
    2 times
    i am a bit sleepy lol

    the code i posted earlier works in that instance... however if i add the <?php include 'testfile.txt';?> to my current webpage layout... it simply displays whats in the text file and thats it, no layout no nothing... the text file is simply just a text file... it does the same even if i use a html file...

    im confused lol
    Dream like you'll live forever. Live like you're gonna die 2morrow!

  7. #6
    Senior Member Webzarus's Avatar
    Join Date
    May 2011
    Location
    South Carolina Coast
    Posts
    3,322
    Member #
    27709
    Liked
    770 times
    So the page you have the include on has a flue extension of .php ?

  8. #7
    Senior Member kirman's Avatar
    Join Date
    May 2003
    Location
    UK England
    Posts
    765
    Member #
    1499
    Liked
    2 times
    yup,,, in fact...

    http://connordesign.comyr.com/ thats what my page looks like now...

    and on the same page but as a .php with the include here's what it looks like...

    http://connordesign.comyr.com/test.php
    Dream like you'll live forever. Live like you're gonna die 2morrow!

  9. #8
    Senior Member Webzarus's Avatar
    Join Date
    May 2011
    Location
    South Carolina Coast
    Posts
    3,322
    Member #
    27709
    Liked
    770 times
    One of 2 things going on here.

    1. Either you testfile is not on the server
    2. You hosting provider doesn't allow file extensions .txt

    Test by : http://connordesign.comyr.com/testfile.txt

    I suspect either the hosting company may have turned off this extension by default in the isapi filters, or you have to turn it on in your control panel.

    For testing... Rename the text file .php , and change your include directive... Upload and test to see if it works.


Remove Ads

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
All times are GMT -6. The time now is 10:24 PM.
Powered by vBulletin® Version 4.2.3
Copyright © 2019 vBulletin Solutions, Inc. All rights reserved.
vBulletin Skin By: PurevB.com