n3m1s1s Posted June 30, 2008 Share Posted June 30, 2008 Hey guys, hopefully my question makes some sense: foreach ($lines as $line_num => $line) { $find = array("%page_title%", "%main%"); $replace = array($page_title, include($main)); $line = str_replace($find,$replace,$line); print $line; } the include($main) just does the include($main) every time it loops instead of replace the %main% How would I get it to replace the %main% with include($main)...if that's possible... Thanks a whole lot. Link to comment https://forums.phpfreaks.com/topic/112652-solved-array-with-php-functions/ Share on other sites More sharing options...
mikefrederick Posted June 30, 2008 Share Posted June 30, 2008 you can't put include in an array like that...what is $main? Link to comment https://forums.phpfreaks.com/topic/112652-solved-array-with-php-functions/#findComment-578527 Share on other sites More sharing options...
n3m1s1s Posted June 30, 2008 Author Share Posted June 30, 2008 The $main is main.html so I was going to have and index.html and a loop scan through that to find the %main% and where the %main% was it would include the main.html file Link to comment https://forums.phpfreaks.com/topic/112652-solved-array-with-php-functions/#findComment-578533 Share on other sites More sharing options...
mikefrederick Posted June 30, 2008 Share Posted June 30, 2008 no you can't use include like that, check out file_get_contents Link to comment https://forums.phpfreaks.com/topic/112652-solved-array-with-php-functions/#findComment-578540 Share on other sites More sharing options...
n3m1s1s Posted June 30, 2008 Author Share Posted June 30, 2008 Ah yeah, thanks a lot...did exactly what I needed Link to comment https://forums.phpfreaks.com/topic/112652-solved-array-with-php-functions/#findComment-578559 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.