Jump to content

[SOLVED] Simple include problem?


lindm

Recommended Posts

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

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";

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.