rain13 Posted August 10, 2010 Share Posted August 10, 2010 HelloHow I can display other php file in my file?I tried: echo FileRead("./chat/index.php");And that's FileRead() function FileRead($sFile){$fd = fopen ($sFile , "r");if ($fd) {$fstring = fread ($fd , filesize ($sFile));fclose($fd);return $fstring;}else{echo '<font color="#FF0000">ERROR:</font> Can not read file '.$sFile;return false;}} This code displays php part as plain text, and executes only html code. But how I can also execute php code? I wan't it look like iframe html. Reason why I read php file instead of using iframe is iframe doesn't look nice and it don't have dynamich height. So don't suggest me using iframe!If there's no way to do it with php, is there something nicer that iframe? Link to comment Share on other sites More sharing options...
alexnofue Posted August 10, 2010 Share Posted August 10, 2010 Hi, you could check evalhttp://co.php.net/manual/en/function.eval.php(not quite sure this works for a whole file, maybe line by line) Link to comment Share on other sites More sharing options...
music_lp90 Posted August 10, 2010 Share Posted August 10, 2010 If I understand what you want correctly, what you want is to use include("./chat/index.php") or require("./chat/index.php").Here are links to explanations about these functions.http://php.net/manual/en/function.include.phphttp://us3.php.net/manual/en/function.require.php Link to comment Share on other sites More sharing options...
rain13 Posted August 10, 2010 Author Share Posted August 10, 2010 ah right. I am wondering how does phpbb forum display that nice page? it has lots of html and php files but i dont see echo,iframe or include that much in it's source. Link to comment Share on other sites More sharing options...
real_illusions Posted August 10, 2010 Share Posted August 10, 2010 ah right. I am wondering how does phpbb forum display that nice page? it has lots of html and php files but i dont see echo,iframe or include that much in it's source.You wont see any PHP in its source code (what the browser shows as source code).PHP is parsed by the server and then its output is displayed by the browser. Link to comment Share on other sites More sharing options...
rain13 Posted August 10, 2010 Author Share Posted August 10, 2010 Does phpbb generate temp file or it displays html directly? There alots of html files in template dir but it looks from browser like one nice html. Link to comment Share on other sites More sharing options...
Ingolme Posted August 10, 2010 Share Posted August 10, 2010 PHPBB has a complex template engine. Look in their includes folder for the template class file. Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.