I am working on a little project the aim of which is to store all aspects of my web site in my database.
Storing content is all well and good, but I want to be able to store little chunks of HTML (I'm actually using XHTML, but that doesn't really matter.) and little chunks of PHP.
So say I'm storing a standardized <head> that I can reuse on a bunch of pages. It looks like this:
<head><title>$titleOfPage</title></head>
This is stored in the database. I can successfully retrieve it using PHP, storing it into '$headFromDB' or whatever, and I can set the variable '$titleOfPage'. Of course, when I 'print ("$headFromDB");', the '$titleOfPage' is not interpolated in...
So, I'm wondering if there's a way I can force it to be interpolated...
I suppose the database example clutters the issue unneccessarily... my problem really looks like this:
1 <?php
2 $insertInto = 'Text is not $toInsert';
3 $toInsert = 'INSERTED';
4 echo ("$toInsert");
5 echo ("$insertTo");
6 ?>
Line 4 displays "INSERTED"
Line 5 displays "Text is not $toInsert"
I want line 5 to display "Text is not INSERTED". And that is the crux of my problem... Is there a way to do this?