UBB.Dev
Posted By: jfreund Reply Counter - 04/02/2001 8:14 PM
How can I display the total number of replies to a topic on the public_topic_page? I tried referencing $total_replies, but it doesn't display anything. Basically I just want to take the value from public_forum_page and put it on public_topic_page. Any ideas?
Posted By: Charles Capps Re: Reply Counter - 04/02/2001 9:18 PM
You'll have to find the array that holds the complete thread file (find a call to &OpenTopic()) - the value of scalar(@array) for that array will be the total number of POSTS in the thread. Subtract one to get the number of replies. (This information should be in lib_posting)
Posted By: jfreund Re: Reply Counter - 04/02/2001 11:51 PM
ok thanks, but is there any way to just reference $total_replies like in the public_forum_page.pl file? Where does that variable come from?

Thanks,

Jeremy
Posted By: Slurpee Re: Reply Counter - 04/03/2001 1:44 AM
The $total_replies variable comes from the ubb_forum.cgi file, so you can't use it on the threads page. Like Charles said, you will have to call the file that holds the array for the thread file in ubb_lib_posting.cgi, if you want to be able to use that variable in the public_topic_page.pl template.
Posted By: Charles Capps Re: Reply Counter - 04/03/2001 1:45 AM
You will have to create it:

my $total_replies = scalar(@array_that_contains_the_posts);
Posted By: jfreund Re: Reply Counter - 04/03/2001 2:01 AM
Thanks guys...I think that I need to study up on my PERL because I don't really know how to do what you are saying. How do I call the file that holds the array for the thread file? Is there any way you could give me the exact syntax?
Posted By: Charles Capps Re: Reply Counter - 04/03/2001 3:00 AM
You shouldn't need to (and should NOT) do that on your own - the array exists.

Search through lib_posting and the other two ubb_ files dealing with creating a new thread and creating a reply. There will be calls to the OpenTopic() subroutine.. it's just a matter of finding which one is doing the job you want...
Posted By: jfreund Re: Reply Counter - 04/03/2001 3:55 PM
OK. So all I need to do is call the subroutine that creates the thread? How do I pass the array into the public_topic_pages file? I would appreciate it forever if you could tell me the syntax for "calling" subroutine in the lib and ubb files. I'm just not familiar with the PERL syntax.

Thanks...
© UBB.Developers