DBookatay Posted April 14, 2008 Share Posted April 14, 2008 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 More sharing options...
mrdamien Posted April 14, 2008 Share Posted April 14, 2008 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 More sharing options...
DBookatay Posted April 14, 2008 Author Share Posted April 14, 2008 Thanks mrdamien, that was what I was looking for... Link to comment https://forums.phpfreaks.com/topic/101000-solved-php-includes/#findComment-516504 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.