jamslam
Wed 30th Jul '03, 1:40pm
Ok, what i'm trying to do here is set it so in a string "$hello" displays something else... Here is what i have...
eval("\$hello = \"".get_template("test")."\";");
print(get_template('main'));
print("$hello");
and here is the get_template function...
function get_template($template) {
$fetch_template_query = "SELECT template_content FROM template WHERE template_name = '".$template."' LIMIT 1";
$fetch_template_run = mysql_query($fetch_template_query);
$fetch_template = mysql_fetch_array($fetch_template_run);
$template = $fetch_template['template_content'];
$template = stripslashes($template);
return $template;
}
As you can see, i eval "$hello" to print the template "test" which is in the database... when i do print("$hello"); it works perfectly fine... however, if i have "$hello" among other text in a database template, it will simply display as "$hello"... There must be something i'm missing with eval and such... As in vB uses a method like this. So can anyone help me?
eval("\$hello = \"".get_template("test")."\";");
print(get_template('main'));
print("$hello");
and here is the get_template function...
function get_template($template) {
$fetch_template_query = "SELECT template_content FROM template WHERE template_name = '".$template."' LIMIT 1";
$fetch_template_run = mysql_query($fetch_template_query);
$fetch_template = mysql_fetch_array($fetch_template_run);
$template = $fetch_template['template_content'];
$template = stripslashes($template);
return $template;
}
As you can see, i eval "$hello" to print the template "test" which is in the database... when i do print("$hello"); it works perfectly fine... however, if i have "$hello" among other text in a database template, it will simply display as "$hello"... There must be something i'm missing with eval and such... As in vB uses a method like this. So can anyone help me?