1
blaze1
Block which show categories from Articles module
  • 2006/3/8 20:51

  • blaze1

  • Just popping in

  • Posts: 3

  • Since: 2006/3/8 1


I am using module from https://xoops.org/modules/repository/singlefile.php?cid=95&lid=1555

I 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

2
blaze1
Re: Block which show categories from Articles module
  • 2006/3/9 18:38

  • blaze1

  • Just popping in

  • Posts: 3

  • Since: 2006/3/8 1


Has anyone any ideas? I've been still trying do something with this, but without any results...

Login

Who's Online

185 user(s) are online (36 user(s) are browsing Support Forums)


Members: 0


Guests: 185


more...

Donat-O-Meter

Stats
Goal: $100.00
Due Date: Nov 30
Gross Amount: $0.00
Net Balance: $0.00
Left to go: $100.00
Make donations with PayPal!

Latest GitHub Commits