SitePoint Sponsor

User Tag List

Results 1 to 5 of 5
  1. #1
    SitePoint Evangelist bals28mjk's Avatar
    Join Date
    Aug 2007
    Posts
    405
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Writing php code to a file.

    Hey guys,

    While writing a string for a file, I keep getting tripped up. The thing is when I'm trying to include php code inside the file, it doesn't recognize it as php code. Instead it recognizes it as part of the html.

    It's really weird because whenever I check the text file it has the proper php syntax.

    This wasn't happening to me before while coding things like this, but happening now. Any thoughts?

  2. #2
    SitePoint Addict
    Join Date
    Apr 2007
    Posts
    300
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Do you have the code in the include file enclosed in php tags ?

  3. #3
    SitePoint Evangelist bals28mjk's Avatar
    Join Date
    Aug 2007
    Posts
    405
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    The way the code is written, I should have been putting the variables before the includes.

    My questions details more here.

    Cheers.

  4. #4
    SitePoint Addict
    Join Date
    Apr 2007
    Posts
    300
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    The problem is you have code where php tags are enclosed as shown below and that is just not going to work simply because for php it is a string.

    PHP Code:

    $main = '<?php $this "some value"?>';

  5. #5
    SitePoint Evangelist bals28mjk's Avatar
    Join Date
    Aug 2007
    Posts
    405
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thanks for the suggestion, but I got it.

    The string with the php code tags was being used to write to another file, the link I posted says what I did differently.


Bookmarks

Posting Permissions

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