ShoeLace1291 Posted September 12, 2007 Share Posted September 12, 2007 Ok, in the file 'index_body.tpl', I want the variable 'GAMESLIST' to include the file 'includes/getgames.php'. Is there another way to get the file without displaying it twice? This is my code: //VV also displays getgames.php $displaygames = include("includes/getgames.php"); $temps = array( 'GAMESLIST' => $displaygames ); $displaygames = file_get_contents("themes/default/index_body.tpl"); foreach($temps as $template_var => $replacement_var){ $displaygames= str_replace($template_var, $replacement_var, $displaygames); } echo $displaygames; Link to comment https://forums.phpfreaks.com/topic/69106-another-way-to-include-files/ Share on other sites More sharing options...
brent123456 Posted September 13, 2007 Share Posted September 13, 2007 You could try $displaygames = require_once("includes/getgames.php"); Link to comment https://forums.phpfreaks.com/topic/69106-another-way-to-include-files/#findComment-347529 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.