1
Brawn
News module: how to show number of comments
  • 2004/5/25 13:24

  • Brawn

  • Just popping in

  • Posts: 24

  • Since: 2004/4/13


On the mainpage (news module) you can see with every article how many comments are posted next to the 'read more' link ($morelink).

I want to show this number also above the first comment of that story:

Number of comments on this article: 3

(all comments)


I was working through that class.newsstory.php document, but can integrate that $ccount/$fullcount into the news_item.html template. Is saw that in there is a comment column in the stories table that shows the amount of comments per story.

Can someone help me with this one?



2
Brawn
Re: News module: how to show number of comments
  • 2004/5/26 8:01

  • Brawn

  • Just popping in

  • Posts: 24

  • Since: 2004/4/13


Can someone please help me on this one?

Under every newsitem the number of comments are already shown. Is it possible to show that number elsewhere in a block or in the newsitem?

3
Mithrandir
Re: News module: how to show number of comments

The number of comments are not available directly in the theme on its own.

To do so, you will need to change the code to include
$xoopsTpl->assign('commentnum'$story->comments());

somewhere in the php file, fetching the data from the database - provided that the story object is called "$story".

After that, you will be able to place a <{$commentnum}> anywhere in the related template to display number of comments.

4
Brawn
Re: News module: how to show number of comments
  • 2004/5/26 9:41

  • Brawn

  • Just popping in

  • Posts: 24

  • Since: 2004/4/13


Hi Mithrandir,

Thank you for replying

I'm very sorry for not understanding it rightaway, but in what php document do I have to include that line? I have added the <{$commentnum}> line in the news_article.html template.

I've included the $xoopsTpl->assign('commentnum', $story->comments()); line in the article.php file (next to all the other $xoopsTpl lines).

But now I receive an blanc page when I go to a news article. So do I need to alter anything else to have this to work?

5
Mithrandir
Re: News module: how to show number of comments

in article.php, the NewsStory object is called $article and not $story, so change $story->comments() to $article->comments()

And put on php debug in general preferences, so you get error messages on blank pages (turn off again, when you have it working)

Login

Who's Online

182 user(s) are online (113 user(s) are browsing Support Forums)


Members: 0


Guests: 182


more...

Donat-O-Meter

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

Latest GitHub Commits