Redlightpacket Posted January 13, 2009 Share Posted January 13, 2009 Below I will tell you what I need help with. // This reads the file into the array. //Do I need a different method right here to put the array into a variable, so //the php and html contents in the file can be created into an another file. $lines = file('http://www.talktopixk.com/post.php'); //Need something to look into the string and replace something in the file string. //str_replace replaces a word in a string $datastr = str_replace("tablestringdatastring", "test", $lines); /////this set of code creates a comment1.php /////////////////////////////////////////////////// $myFile = "comment1.php"; $fh = fopen($myFile, 'w'); $myFile = "comment1.php"; $fh = fopen($myFile, 'w') or die("can't open file"); /////////////////////////////////////////////////// //Write the name of the file. $modFile = "comment1.php"; //But in the end this only writes the html contents and it tries to write php contents of the "post.php", but it don't which I want the PHP contents written to comment1.php file. Why does it stop writing all of the php contents in the php "post.php" file and how can I can be able to write php and html contents together? file_put_contents($modFile,$datastr); fclose($fh); Quote Link to comment Share on other sites More sharing options...
trq Posted January 13, 2009 Share Posted January 13, 2009 Can I ask why your creating php files dynamically in the first place? I smell some poor design. Quote Link to comment Share on other sites More sharing options...
Redlightpacket Posted January 13, 2009 Author Share Posted January 13, 2009 I'm trying to create a comment system, which you make comments to a certain message on another page. The new page that is created will have all of the new comments on it. The comments can keep on adding up. What is a better way to do this? Any body has any good ideas for me? Quote Link to comment Share on other sites More sharing options...
trq Posted January 13, 2009 Share Posted January 13, 2009 Do you really think each time you post a question on this forum a new page is created? Defeats the entire purpose of a database driven site. Store your comments in a database and relate them to a topic via with a common id. Quote Link to comment Share on other sites More sharing options...
Redlightpacket Posted January 14, 2009 Author Share Posted January 14, 2009 you had to had a template page for this didn't you? Quote Link to comment Share on other sites More sharing options...
trq Posted January 14, 2009 Share Posted January 14, 2009 This is a database driven application. No new files are created when a post is made. Sorry, but I think your missing a big part of the picture here. Quote Link to comment Share on other sites More sharing options...
Redlightpacket Posted January 14, 2009 Author Share Posted January 14, 2009 I got you on the database part, but I know you had to create a template page for this page. Quote Link to comment Share on other sites More sharing options...
DarkSuperHero Posted January 14, 2009 Share Posted January 14, 2009 yes...much like one can use the same design on many pages.....but its one page...that draws information from one database to put it simple.. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.