I have this script (well commented!) that searches files in a folder using regular expressions, removes comments and HTML, but leaves the tag intact. I would want this script to do the same, but instead of leaving tag's intact, it need to print the include it finds to file.
For example:
<!--TPFILE--><?include '/module/menu.html';?><!--TPFILEEND-->
So the goal is to print out the HTML from menu.html to where the regular expression found the include. I'm very new to PHP but understand the basics, though, I'm stuck on this one.
EDIT: I found a solution, it's posted as an answer below.
Is this syntax required : <?include '/module/menu.html';?>
? Could you replace this with <?php include '/blah/foo.php';?>
? If so, you could either directly include the file, or use token_get_all()
to split the HTML up in to PHP chunks and normal string (HTML) output.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With