Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3
  1. #1
    New to the CF scene
    Join Date
    Mar 2009
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    REQ. displaying sections from text file

    If you respond, please give an example as my "expertise" is "nil".

    In searching this forum, I've come up with:
    txtfile.txt
    one=this is the first section
    two=this is the second section
    three=this is the third section

    AND
    PHP Code:
    <?php
    list(, $content) = explode('two='file_get_contents('txtfile.txt'));
    echo 
    $content;
    ?>
    Problem being: "this is the second section three=this is the third section" displays, rather than "this is the second section".

    From what I see here, "trim" can be used to solve this.

    After several hours, trying every possibility I could think of, I am admitting defeat and begging for help...please.

  • #2
    Senior Coder rafiki's Avatar
    Join Date
    Aug 2006
    Location
    Floating around somewhere...
    Posts
    2,043
    Thanks
    19
    Thanked 42 Times in 42 Posts
    You would have to explode the variable which contains part two by partthree and use the $var['0'];

  • #3
    New to the CF scene
    Join Date
    Mar 2009
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Quote Originally Posted by rafiki View Post
    You would have to explode the variable which contains part two by partthree and use the $var['0'];
    As I said, please give an example as my "expertise" is "nil".

    Also, would you please explain why "trim" wouldn't work if the correct syntax were used.


  •  

    Posting Permissions

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