PHP - Parsing PHP in includes

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Dusen
    Confirmed User
    • Aug 2002
    • 2251

    #1

    PHP - Parsing PHP in includes

    I'm trying to include() a file that has a .txt extension. What I'd like to do is parse some PHP on that text file as well.

    It's not working

    What I have done is set .txt as php parsable in htaccess. No go. Any ideas?
    Penis Pill Sponsor List and Reviews:
    http://www.pillsponsors.com
  • AcidMax
    Confirmed User
    • May 2002
    • 1827

    #2
    Why not just make the .txt a .php extension and include it?

    Otherwise maybe you can try something like the eval function

    http://us2.php.net/eval and see if that works.

    -- below may or may not work for you --
    $text = join('', file('/path/to/text/file'));

    echo eval($text);
    Latest MMA news. http://www.mmawrapup.com

    Comment

    • Serge Litehead
      Confirmed User
      • Dec 2002
      • 5190

      #3
      have it as .php and dont forget about opening and closing php tags <? ... ?> inside the include file.

      Comment

      • Serge Litehead
        Confirmed User
        • Dec 2002
        • 5190

        #4
        Originally posted by Dusen
        I'm trying to include() a file that has a .txt extension. What I'd like to do is parse some PHP on that text file as well.

        It's not working

        What I have done is set .txt as php parsable in htaccess. No go. Any ideas?
        btw code or error msg would be helpful to see whats wrong.

        Comment

        Working...