joprout
09-22-2004, 01:18 PM
Hi everyone, i'm currently updating my website and i try to do as much professionnal as possible. So what i do is i store all the major templates into my database. But i have a problem.
I have a function that call my template codes which is in my function.php file:
class templates
{
function show_templates($name)
{
$result = mysql_query( "SELECT * FROM templates WHERE name='$name'");
$t = mysql_fetch_array($result);
$templa = $t[template]; /// $t[template]; is where the template code is store.
print $templa;
}
}
Now on the page that i need the template, here's what i basicly write:
include('function.php');
$temp = new templates;
$str = "hello";
$temp->show_templates("admin_printer_tablehead");
Everything's fine, all the HTML codes works. The problem is, the PHP Variables that are in my templates. They don't show! The website read them as an HTML code as well. So instead of showing what the variable equal, it shows the variable itself. (e.g. $str = "hello". Instead of showing Hello, it will show $str. )
Is there a function that would help me with my problem ?
I have a function that call my template codes which is in my function.php file:
class templates
{
function show_templates($name)
{
$result = mysql_query( "SELECT * FROM templates WHERE name='$name'");
$t = mysql_fetch_array($result);
$templa = $t[template]; /// $t[template]; is where the template code is store.
print $templa;
}
}
Now on the page that i need the template, here's what i basicly write:
include('function.php');
$temp = new templates;
$str = "hello";
$temp->show_templates("admin_printer_tablehead");
Everything's fine, all the HTML codes works. The problem is, the PHP Variables that are in my templates. They don't show! The website read them as an HTML code as well. So instead of showing what the variable equal, it shows the variable itself. (e.g. $str = "hello". Instead of showing Hello, it will show $str. )
Is there a function that would help me with my problem ?
