lindm Posted August 18, 2009 Share Posted August 18, 2009 I have a phpscript generating html code in a variable, like: $html="code goes here"; Now I have an external file (say html2.php) with some additional code I want to include in the middle of the $html string. My first thought was like this: $html="code '.include("html2.php").'goes here"; That seems to be a nogo. Any simple solutions? I need the setup where the html code is in a string... Link to comment https://forums.phpfreaks.com/topic/170890-solved-simple-include-problem/ Share on other sites More sharing options...
mikesta707 Posted August 18, 2009 Share Posted August 18, 2009 $html = "code blah blah blah include(\"html2.php\") goes here"; just write include() inside the string. Don't concatenate it, b/c it will execute then, and won't execute when the code is output, or echo'd. Hope that helps! Link to comment https://forums.phpfreaks.com/topic/170890-solved-simple-include-problem/#findComment-901313 Share on other sites More sharing options...
KevinM1 Posted August 18, 2009 Share Posted August 18, 2009 I have a phpscript generating html code in a variable, like: $html="code goes here"; Now I have an external file (say html2.php) with some additional code I want to include in the middle of the $html string. My first thought was like this: $html="code '.include("html2.php").'goes here"; That seems to be a nogo. Any simple solutions? I need the setup where the html code is in a string... Try: $html = "code"; include("html2.php"): $html .= "goes here"; Link to comment https://forums.phpfreaks.com/topic/170890-solved-simple-include-problem/#findComment-901314 Share on other sites More sharing options...
lindm Posted August 18, 2009 Author Share Posted August 18, 2009 Thanks!! Link to comment https://forums.phpfreaks.com/topic/170890-solved-simple-include-problem/#findComment-901327 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.