I am very beginner in programmer, I am sorry if my question is crazy thing, but I am being crazy with it :D
I want to create an template for my php file (or replace my string with my php file):
my_string.html
{header}
Some String {foo} Some String {bar} Some String
{footer}
my_file.php
<div class="header"><img src="logo.png" /></div>
<?php if(isset($foo)) { echo "FOO"; } ?>
<?php if(isset($bar)) { echo "BAR"; } ?>
<div class="footer">mywebsite.com</div>
Can I do something like this?
<?php $find = array("{header}", "{foo}", "{bar}", "{footer}"); ?>
<?php $replace = array(
"<div class=\"header\"><img src=\"logo.png"\ /></div>",
"<?php if(isset(\$foo)) { echo \"FOO\"; } ?>",
"<?php if(isset(\$bar)) { echo \"BAR\"; } ?>",
"<div class=\"footer\">mywebsite.com</div>"); ?>
<?php echo str_replace($find, $replace, implode("<br>", file("my_string.html"))); ?>
Results from my_file.php :
<div class="header"><img src="logo.png" /></div>
Some String FOO Some String BAR Some String
<div class="footer">mywebsite.com</div>
Does anyone have a solution for my problem?