1
migoe
AMS 2.41: How can i show the articlecounter in the Block "ams_block_topicnav.html"
  • 2005/10/28 21:18

  • migoe

  • Just popping in

  • Posts: 68

  • Since: 2003/4/2 9


I love the AMS Mod and want to make it possible to show the articlecounter after a Category in the Block "ams_block_topicnav.html" like this:

Category One (5 Articles)
Category Two (4 Articles)

and so on. The counter of the articles in a category is shown in the index.php when you set the option to show articles in topics.

I know, that i must chance or add some code for this, but dont know witch. Can someone give me a tip?

migoe
www.liedermacher-forum.de | German Singers and Songwriters

www.weltladen-rothenburg.de | German Site about Fair trade Project

2
migoe
Re: AMS 2.41: How can i show the articlecounter in the Block "ams_block_topicnav.html"
  • 2005/10/30 12:10

  • migoe

  • Just popping in

  • Posts: 68

  • Since: 2003/4/2 9


I've changed the code of /modules/AMS/blocks/ams_topicsnav.php

function b_ams_topicsnav_show($options) {

    include_once 
XOOPS_ROOT_PATH."/modules/AMS/class/class.newstopic.php";
    include_once 
XOOPS_ROOT_PATH."/modules/AMS/class/class.newsstory.php";

    global 
$xoopsDB$xoopsUser;
    
$block = array();
    
$article_counts AmsStory::countPublishedOrderedByTopic();
    
$topics AmsTopic::getAllTopics($options[0]);
    
$count 1;
    foreach (
$topics as $topic) {
        
$block['topics'][] = array('id' => $topic->topic_id'title' => $topic->topic_title(), 'count' => $count'articlecount' => $article_counts[$topicid]);
        
$count++;
    }
    return 
$block;
}


In the template i inserted "$topic.articlecount" but it shows nothing What's wrong?

migoe
www.liedermacher-forum.de | German Singers and Songwriters

www.weltladen-rothenburg.de | German Site about Fair trade Project

3
migoe
Re: AMS 2.41: How can i show the articlecounter in the Block "ams_block_topicnav.html"
  • 2006/1/15 22:35

  • migoe

  • Just popping in

  • Posts: 68

  • Since: 2003/4/2 9


Nobody who can help me?
www.liedermacher-forum.de | German Singers and Songwriters

www.weltladen-rothenburg.de | German Site about Fair trade Project

4
migoe
Re: AMS 2.41: How can i show the articlecounter in the Block "ams_block_topicnav.html"
  • 2006/1/16 8:25

  • migoe

  • Just popping in

  • Posts: 68

  • Since: 2003/4/2 9


OK, another try. I modified the code a little:

function b_ams_topicsnav_show($options) {

    include_once 
XOOPS_ROOT_PATH."/modules/AMS/class/class.newstopic.php";
    include_once 
XOOPS_ROOT_PATH."/modules/AMS/class/class.newsstory.php";

    global 
$xoopsDB$xoopsUser;
    
$block = array();
    
$article_counts = [u]AmsStory::countPublishedByTopic()[/u];
    
$topics AmsTopic::getAllTopics($options[0]);
    
$count 1;
    foreach (
$topics as $topic) {
        
$block['topics'][] = array('id' => $topic->topic_id'title' => $topic->topic_title(), 'count' => $count'articlecount' => $article_counts[$topicid]);
        
$count++;
    }
    return 
$block;
}


and now it shows allways a 2 (two), but there are definitly more articles in the topics. How must i change the code so that it shows the right count of articles by topic?

migoe
www.liedermacher-forum.de | German Singers and Songwriters

www.weltladen-rothenburg.de | German Site about Fair trade Project

Login

Who's Online

214 user(s) are online (131 user(s) are browsing Support Forums)


Members: 0


Guests: 214


more...

Donat-O-Meter

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

Latest GitHub Commits