Hello,
Say I have one .html file and one .php file, as templates. I need to dynamically to replace some of the text in those two files with PHP script. For example, I need to replace
action="myphp.php" with action="mynewphp.php" in the form of .html file,
and, replace in the .php file:
$my_file = "myphp.php";
with
$my_file = "mynewphp.php";
So that my .html and .php files dynamically points to different ones, as needed.
To achieve this, I think I need to read the .html and .php file as text, then do the replacement, then save back to .html and .php file formats....
I am not sure if file_get_contents and file_put_contents will work (both get to and save from a string). I quickly tried them but no luck.
Anyone can offer some pointers? Thanks in advance.
Jason