Jump to content

[SOLVED] PHP Includes


DBookatay

Recommended Posts

How do you do an include where it is already in php?

Meaning:

if ($_GET['tab'] == "TestDrive"){
$show = '
<table class="ftrHldr">
   <tr>
      <td valign="top"><div class="specHdr">Affordability Calculator</div><? include ('include/page_files/affordability_calculator.php'); ?></td>
   </tr>
</table>';
}

Link to comment
https://forums.phpfreaks.com/topic/101000-solved-php-includes/
Share on other sites

If you don't need anything to be executed, your better off using

$calculator = file_get_contents('include/page_files/affordability_calculator.php');

$show = '
<table class="ftrHldr">
   <tr>
      <td valign="top"><div class="specHdr">Affordability Calculator</div>' . $calculator . '</td>
   </tr>
</table>';

 

If you do need something to be executed, put the code into functions. Then you can do this:

<?
include('include/page_files/affordability_calculator.php');
if ($_GET['tab'] == "TestDrive"){
$show = '
<table class="ftrHldr">
   <tr>
      <td valign="top"><div class="specHdr">Affordability Calculator</div>' . calculator_function() . '</td>
   </tr>
</table>';
}

?>

 

Link to comment
https://forums.phpfreaks.com/topic/101000-solved-php-includes/#findComment-516496
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.