With a normal SELECT in the mySQL DB I select the HTML content of the final page.
I am building a way to create pages on the fly ( as any CMS does ) and I am saving the HTML code for each page inside a specific table fo my DB.
The problem is I want the content to be multi-language. But I do not know how to SELECT html code from the DB and before printing it, working on it with PHP.
I know it's hard to understand, this is why I have an example :)
$q='SELECT * FROM pages WHERE Page="'.$page.'"';
$r=mysql_query($q) or die(mysql_error());
while($row = mysql_fetch_array($r)) {
$content = $row['Content'];
}
return $content;
}
The Content of the variable $content, will be something like:
<div id="hello">{$foo}</div>
where {$foo} is in fact a PHP variable and must be run by the PHP code before printing the final HTML.
How can I do that? Also please consider I will have many {$foo} variables into the content, so I must find a way to replace all of them and to make the PHP working on them before printing the final HTML code.
Can you help me? :)
{$var}syntax. Many do.