Jump to content

Str_replace


unidox

Recommended Posts

No.  You'd need to access content.php through the HTTP wrapper.

 

$template = file_get_contents("page.htm");

$template = str_replace("<{CONTENT}>",file_get_contents("http://www.yoursite.com/content.php"),$template);

 

But quite frankly, that's a horrible templating system. Why not use Smarty?

Link to comment
https://forums.phpfreaks.com/topic/115882-str_replace/#findComment-595813
Share on other sites

Um, lol, there's a lot easier way of doing it without using Smarty.

 

<?php

function tpl($output){
$find = array("<{CONTENT}>","<{FOOTER}>");
$repl = array(file_get_contents("content.php"), file_get_contents("footer.php"));

return str_replace($find, $repl, $output);
}

ob_start("tpl");

echo "<{CONTENT}>";
echo "<{FOOTER}>";

ob_end_flush();
?>

Link to comment
https://forums.phpfreaks.com/topic/115882-str_replace/#findComment-595846
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.