Jump to content

Another Way To Include Files?


ShoeLace1291

Recommended Posts

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

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.