Displaying a .txt file in a web page...

2»

Comments

  • CannonBallGuyCannonBallGuy Moderator Shared Hoster
    Oh, my!
    Myabe that's why it is not working. Silly me!

    Sheesh!
    What do you take me for tnt?
  • CannonBallGuyCannonBallGuy Moderator Shared Hoster
    I did the <!--#include virtual="/path/to/file/filename.txt" --> thing... but There are still no returns on the shtml page where there were in the .txt...
  • JayDesignsJayDesigns Beginner Link Clerk
    Your server must have SSI installed.
    JayDesigns.co.uk
  • CannonBallGuyCannonBallGuy Moderator Shared Hoster
    Yeah. It does...

    It's at art.pavsta.com/layout1.shtml
    the text file is at art.pavsta.com/layout1.txt

    So you can see that the returns in the .txt are not showing on the .shtml...

    Unless it's just me... lol
  • PythonPython Forum Leader The Royal RAM
    i just took a look and its showing fine...i like food :)

    The Royal Ram

  • CannonBallGuyCannonBallGuy Moderator Shared Hoster
    On Safari, IE and Shiira (on OSX) the .txt file comes out with no returns... Just one lump of text.
  • PythonPython Forum Leader The Royal RAM
    im using winxp and mozilla and it had no returns

    The Royal Ram

  • CannonBallGuyCannonBallGuy Moderator Shared Hoster
    So it aint working... And is there NO other way I can try???
  • tntcheatstntcheats Senior Member The Royal RAM
    What do you take me for tnt?
    Do you really want to know :lol: ;) :twisted:

    I'd say you should just use a very simple CMS.
    Like EZarticle. (I think that's the name) watch out for security though.
  • CannonBallGuyCannonBallGuy Moderator Shared Hoster
    I think I will just get the client to type it in as a .txt anyway. then copy it into th webpage and just add the <br> 's... lol
  • tntcheatstntcheats Senior Member The Royal RAM
    Become his webmaster and just charge a small fee for updates.
  • CannonBallGuyCannonBallGuy Moderator Shared Hoster
    Yeah... exactly. :D
  • JayDesignsJayDesigns Beginner Link Clerk
    To replace the returns with br tags, use this:

    <?php
    $file = "textfile.txt";
    $do = fopen($file, "r");
    $data = fread($do, filesize($file));
    fclose($do);
    $data_correct = str_replace ("\n","<br>",$data);
    echo $data_correct;
    ?>

    Hopefully that will replace the returns with br tags. Let me know if it works.
    JayDesigns.co.uk
  • CannonBallGuyCannonBallGuy Moderator Shared Hoster
    When I tried that it nothing showed up so I even tried:

    <?php
    include("layout1.txt");
    $file = "layout1.txt";
    $do = fopen($file, "r");
    $data = fread($do, filesize($file));
    fclose($do);
    $data_correct = str_replace ("\n","<br>",$data);
    echo $data_correct;
    ?>

    But that didn't work either... :(
  • JayDesignsJayDesigns Beginner Link Clerk
    ok cannonballguy, if you send the files to me at jay@jaydesigns.co.uk I'd be happy to do it for you, free of charge :)
    JayDesigns.co.uk
  • CannonBallGuyCannonBallGuy Moderator Shared Hoster
    Why can't you just tell me how to do it?
    If you want to test it then you can just make your own .txt file... lol...
    The .txt file I am trying to get to show in the html page just says "I love Food!" over and over... lol
  • JayDesignsJayDesigns Beginner Link Clerk
    Good point cannonball, good point.

    OK, I created a php page called 'cannonball.php' and a text file called 'test.txt'

    Contents of 'test.txt':

    I love food, I LOVE FOOD

    I love food so much...

    I love it so.

    Contents of 'cannonball.php':

    <?php

    $file = "test.txt";
    $do = fopen($file, "r");
    $data = fread($do, filesize($file));
    fclose($do);
    $data_correct = str_replace("\n","<br>",$data);
    echo $data_correct;

    ?>

    And that works on my pc. If its not on yours, I suggest you check both files are in the same directory, there aren't any spelling errors when specifying filenames, and the .txt file may need to be CHMODed, but I'm not sure what to. Try 777 :)
    JayDesigns.co.uk
  • djwave28djwave28 Beginner Link Clerk
    Maybe I'm messing with something, but how does your client set up their document. Is that in Microsoft :eek: Word ? .. Can't Word save that in html format and you can still edit it... and the client can decide what he's doing with it ... :rolleyes:

    DJWave
  • CannonBallGuyCannonBallGuy Moderator Shared Hoster
    This is really really old now... But Microsoft Word saves files with terrible code...
    Depreciated tags, etc...
  • kinkkink serious member VPS - Virtual Prince of the Server
    cg use a javascript, such as
    <script type="text/javascript" href="yourspot">
    var rt = textarea.name.value;
    document.html.page.textrea.vakue = rt;
    </script>

    this is not a working script but i think youll get the idea
  • CannonBallGuyCannonBallGuy Moderator Shared Hoster
    This is really really old now...


    Why does everyone just reply to every topic in the "New Posts" page without even reading the topic to see if the problem has been solved or what-not?
    ARGH!
  • kinkkink serious member VPS - Virtual Prince of the Server
    cbg use a textarea forinstance

    <textarea name="salk">
    </textarea>


    then use
    <script type="text/javascript>
    function afunction
    {
    var ads = document.salk.value:
    document.write(" + ads + ");
    }
    </script>


    check it out hope it helps
  • CannonBallGuyCannonBallGuy Moderator Shared Hoster
    This post is like, 4 months old... lol
Sign In or Register to comment.