1
I am using module from
https://xoops.org/modules/repository/singlefile.php?cid=95&lid=1555I want make block, which will show categories from articles module. and it should work on each page.
I've tried do something like this:
I copied part code from index.php from articles folder:
$myts =& MyTextSanitizer::getInstance();
if (!isset($_GET['cat_id'])) {
$result = $xoopsDB->query("SELECT id, cat_name, cat_description, cat_options FROM " .$xoopsDB->prefix('articles_cat') . " WHERE cat_showme=1 ORDER BY cat_weight ASC");
while (list($id, $cat_name, $cat_description, $cat_options) = $xoopsDB->fetchRow($result)) {
$category = array();
$category['cat_name'] = $myts->htmlSpecialChars($myts->stripSlashesGPC($cat_name));
$category['id'] = $id;
$xoopsTpl->append_by_ref('categories', $category);
unset($category);
}
} // end if
I saved this file as index2.php in the same folder. After this in file header.php in the main xoops' folder I added line
include_once XOOPS_ROOT_PATH.'/modules/articles/index2.php';
and after in file theme.html in my theme folder I added (in place where I want have this menu):
<{foreach item=category from=$categories}>
<tr>
<td>
<table border="0" cellspacing="2" style="width: 100%">
<tr>
<td colspan="3" class="even" style="width: 100%">
<strong><a href="modules/articles/index.php?cat_id=<{$category.id}>"><{$category.cat_name}>a>strong>
td>
tr>
table>
td>
tr>
<{/foreach}>
And in the main page it works ok. When I go to main module page /modules/articles/ it works ok too. But when I click at link to any category it opens, but that my "block" show then only name of active category. But I want it always show all of the categories.
Could you help me do something with this? Or maybe other ideas? You can look this page at
http://skauting.pl/xoops/P.S.
sorry for my english