ngreenwood6 Posted June 12, 2009 Share Posted June 12, 2009 Is there a way to use an include in array? I am trying to do this: $lang = array_merge($lang, array( 'TERMS_OF_USE_CONTENT' => include("terms-of-service.php") , I have also tried this: $lang = array_merge($lang, array( 'TERMS_OF_USE_CONTENT' => '<? include("terms-of-service.php"); ?>', The first one works but when it displays it, it shows up in the background and not within the content. The other one doesnt display anything. Any help is appreciated. Link to comment https://forums.phpfreaks.com/topic/161941-solved-using-include-in-array/ Share on other sites More sharing options...
rhodesa Posted June 12, 2009 Share Posted June 12, 2009 ob_start(); include("terms-of-service.php"); $terms = ob_end_clean(); $lang = array_merge($lang, array( 'TERMS_OF_USE_CONTENT' => $terms, by the sounds of it though, you should look into a templating system like Smarty Link to comment https://forums.phpfreaks.com/topic/161941-solved-using-include-in-array/#findComment-854453 Share on other sites More sharing options...
ngreenwood6 Posted June 12, 2009 Author Share Posted June 12, 2009 Thanks for the reply. I tried what you said but it just has a 1 where the data is supposed to be. Any ideas? Link to comment https://forums.phpfreaks.com/topic/161941-solved-using-include-in-array/#findComment-854459 Share on other sites More sharing options...
rhodesa Posted June 12, 2009 Share Posted June 12, 2009 oops...use ob_get_clean() instead Link to comment https://forums.phpfreaks.com/topic/161941-solved-using-include-in-array/#findComment-854461 Share on other sites More sharing options...
ngreenwood6 Posted June 12, 2009 Author Share Posted June 12, 2009 Thanks that is great. Worked perfectly Link to comment https://forums.phpfreaks.com/topic/161941-solved-using-include-in-array/#findComment-854467 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.