1
I don't know if I'm missing anything, but for some reason, Smarty absolutely refuses to print my variable!
This is my php code:
require('../../mainfile.php');
if ( !empty($HTTP_POST_VARS['action']) ) {
$do = $HTTP_POST_VARS['action'];
} elseif (!empty($HTTP_GET_VARS['action'])) {
$do = $HTTP_GET_VARS['action'];
}
// Our table of editions
$table = $xoopsDB->prefix('cr_editions');
// Fetch all our editions
$result = $xoopsDB->query("SELECT * FROM $table");
if ($xoopsDB->getRowsNum($result) >= 1) {
$editions = array();
while ($rows = $xoopsDB->fetchArray($result))
array_push($editions, $rows['edition']);
}
if($do=="browse") {
// We must always set our main template before including the header
$xoopsOption['template_main'] = 'nav_browser.html';
// Include the page header
require(XOOPS_ROOT_PATH.'/header.php');
$xoopsTpl->assign('edition', $editions[0]);
// Include the page footer
require(XOOPS_ROOT_PATH.'/footer.php');
} elseif($do=="search") {
$xoopsOption['template_main'] = 'nav_search.html';
require(XOOPS_ROOT_PATH.'/header.php');
require(XOOPS_ROOT_PATH.'/footer.php');
}
?>
Now, here's my really simple test template:
<p><{$edition}>p>
it doesn't print the variable $edition! It does print the
though. I also turned on Smarty debug to check the variable, and the variable $edition does in fact have the value I want it to print. Now here's where it gets even stranger:
if, instead of printing $edition, i try to print the variable $table, which is just the table returned by the xoopsDB call, it works (IE I replace the line
$xoopsTpl->assign('edition', $editions[0]);
with
$xoopsTpl->assign('table', $table);
and change the template var accordingly, it prints the table name. Am I missing something really obvious? I've been trying for hours, and I'm at my wit's end :(