1
I have a head scratcher of a problem. Hopefully, I'm overlooking something simple that others will see easily.
I am writing a simple module which will just display all the images in a folder and put some text at the top.
Here's the xoopsversion.php:
$modversion['name'] = "Cheeka Peak Plots";//name of module
$modversion['version'] = 1;
$modversion['description'] = "Display the Cheeka Peak Plots";
$modversion['author'] = "Jeremy Smith";
$modversion['credits'] = "";
$modversion['help'] = "";
$modversion['license'] = "GPL see LICENSE";
$modversion['official'] = 0;
$modversion['image'] = "logo.gif";
$modversion['dirname'] = "cpo_plot";//name of directory on server
// Admin things
$modversion['hasAdmin'] = 0;
$modversion['adminpath'] = "";
// Menu/Sub Menu
$modversion['hasMain'] = 1;//make 0 to not have this appear in main menu
$modversion['templates'][1]['file'] = 'plots.html';
$modversion['templates'][1]['description'] = 'Displays all the plots';
?>
Here's the index.php:
include_once '../../mainfile.php';
include_once XOOPS_ROOT_PATH.'/header.php';
$dirpath = "../../plots/cpo/";
$plots=array();
if ($xoopsUser) {
$dir = opendir($dirpath);
while(($file = readdir($dir)) != false) {
if (strlen($file) > 4 && substr(strtolower($file),strlen($file) - 4) === '.png' && !is_dir($file)) {
$plots[]=$file;
}
}
closedir($dir);
}
sort ($plots);
$xoopsTpl->assign('dirpath',$dirpath);
$xoopsTpl->assign('plots',$plots);
include_once XOOPS_ROOT_PATH.'/footer.php';
?>
Finally, here's the template:
Hello, look at me!
<{foreach from=$plots item=plot}>
<p>
<img src="<{$dirpath}><{$plot}>">
p>
<{/foreach}>
When I run this, I just get a blank spot in the page (not an entirely blank page, there's just nothing where the module should be). Turning on the various debug options, I get no php errors, but it's clear that the db isn't being queried for the template. The last two queries are looking for private messages and the system_block_user.html. There's nothing after that.
The variables that I send to $xoopsTpl are making it to smarty fine, but it just has nowhere to put them.