barkster Posted July 11, 2007 Share Posted July 11, 2007 I want to have a page that has some html text that I can change randomly and I want to include it into a string on a page so that I can change as needed. How can I do this? I'm looking at something like $html = "This is a test" . include(text.html) . "rest of text"; is this possible? Of course not like I have done it. Thanks Link to comment https://forums.phpfreaks.com/topic/59436-include-page-contents-into-string/ Share on other sites More sharing options...
Yesideez Posted July 11, 2007 Share Posted July 11, 2007 You want random HTML to be run each time the script is run? Link to comment https://forums.phpfreaks.com/topic/59436-include-page-contents-into-string/#findComment-295334 Share on other sites More sharing options...
barkster Posted July 11, 2007 Author Share Posted July 11, 2007 No I just want the text from the html file. Link to comment https://forums.phpfreaks.com/topic/59436-include-page-contents-into-string/#findComment-295339 Share on other sites More sharing options...
Yesideez Posted July 11, 2007 Share Posted July 11, 2007 One way you can do it is to open the HTML file for reading and add it to the string. Link to comment https://forums.phpfreaks.com/topic/59436-include-page-contents-into-string/#findComment-295340 Share on other sites More sharing options...
barkster Posted July 11, 2007 Author Share Posted July 11, 2007 It seems like I've done this somehow before but I can't find my posting. I was hoping for something simpler. Link to comment https://forums.phpfreaks.com/topic/59436-include-page-contents-into-string/#findComment-295344 Share on other sites More sharing options...
per1os Posted July 11, 2007 Share Posted July 11, 2007 <?php $file = file_get_contents('text.html'); $html = "This is a test" . $file . "rest of text"; Link to comment https://forums.phpfreaks.com/topic/59436-include-page-contents-into-string/#findComment-295371 Share on other sites More sharing options...
barkster Posted July 11, 2007 Author Share Posted July 11, 2007 That is what I'm looking for, I knew it was a one liner. Thnaks Frost Link to comment https://forums.phpfreaks.com/topic/59436-include-page-contents-into-string/#findComment-295372 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.