vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB3 General Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=111)
-   -   How do I make my forum categories display threads and posts? (https://vborg.vbsupport.ru/showthread.php?t=210417)

decipher442 04-06-2009 12:26 AM

How do I make my forum categories display threads and posts?
 
Hi,

I came accross this site and was wondering how I can make just my forum categories display all threads and posts in the category bar instead of the sub forum?

HTML Code:

http://www.webtalkforums.com/
Is this done in the admin panel or is it a template modification or hack?

Thanks!

Lynne 04-06-2009 02:30 AM

It isn't a default vbulletin thing. I don't know that I've seen a modification to do it either. But, the code to grab the posts and threads from the forum cache is on the bottom of the index.php page, so it's easy enough to copy and code it yourself.

decipher442 04-06-2009 05:16 AM

What exactly is the code I would need (I can't find it), and would that code display all threads and posts of the categories sub forums?

merk_aus 04-06-2009 07:12 AM

have you even looked or just have no idea and trying to get the code without having to do anything

decipher442 04-06-2009 01:36 PM

I see this.. yes..
HTML Code:

$totalthreads = vb_number_format($totalthreads);
$totalposts = vb_number_format($totalposts);

But as said before.. if placed in the category bar would that code display all threads and posts of all the categories sub forums?

Do you know what template i would edit to have it placed into the category bar?

Lynne 04-06-2009 02:01 PM

This is the full code used to get the total post and thread count. You need to modify it for your own purposes.
PHP Code:

$totalthreads 0;
$totalposts 0;
if (
is_array($vbulletin->forumcache))
{
    foreach (
$vbulletin->forumcache AS $forum)
    {
        
$totalthreads += $forum['threadcount'];
        
$totalposts += $forum['replycount'];
    }
}
$totalthreads vb_number_format($totalthreads);
$totalposts vb_number_format($totalposts); 


decipher442 04-06-2009 02:15 PM

Quote:

Originally Posted by Lynne (Post 1785050)
This is the full code used to get the total post and thread count. You need to modify it for your own purposes.
PHP Code:

$totalthreads 0;
$totalposts 0;
if (
is_array($vbulletin->forumcache))
{
    foreach (
$vbulletin->forumcache AS $forum)
    {
        
$totalthreads += $forum['threadcount'];
        
$totalposts += $forum['replycount'];
    }
}
$totalthreads vb_number_format($totalthreads);
$totalposts vb_number_format($totalposts); 


Thank you :)

Do you know what template I would edit to have it placed into the category bar? (I am assuming I can edit the template via the admin panel in style manager?)

Lynne 04-06-2009 02:26 PM

To find the template to modify, do this - vboptions > General Settings > Add Template Name in HTML Comments > set to Yes . Then go back to your page and view the source code and you will see the name of the template called around your part of the code. Sometimes the template is the one mentioned at the very top of the page source.

decipher442 04-07-2009 04:37 AM

So far no luck :(

After lots of research I see that "forumhome_forumbit_level1_nopost" seems to be the template to edit so that i can make my category bar display total threads and posts of its sub-forums. (just to the left of the category collaps image)

but when I added the PHP code into the template (forumhome_forumbit_level1_nopost) it gave me an error and didn't work..

PHP Code:

<if condition="!$show['collapsable_forums']">
<tbody>
</if>
    <tr>
        <td class="tcat" colspan="<if condition="$vboptions[showmoderatorcolumn]">6<else />5</if>">
            <if condition="$childforumbits">
            <a style="float:$stylevar[right]" href="#top" onclick="return toggle_collapse('forumbit_$forumid')"><img id="collapseimg_forumbit_$forumid" src="$stylevar[imgdir_button]/collapse_tcat{$collapseimg_forumid}.gif" alt="" border="0" /></a>

            </if>
            <a href="forumdisplay.php?$session[sessionurl]f=$forum[forumid]">$forum[title]</a>
            <a style="float:$stylevar[right]">
<?php

$totalthreads 
0
$totalposts 0
if (
is_array($vbulletin->forumcache)) 

    foreach (
$vbulletin->forumcache AS $forum
    { 
        
$totalthreads += $forum['threadcount']; 
        
$totalposts += $forum['replycount']; 
    } 

$totalthreads vb_number_format($totalthreads); 
$totalposts vb_number_format($totalposts); 
            </
a>
 
?>
            <if condition="$show['forumdescription']"><div class="smallfont">$forum[description]</div></if>
            <if condition="$show['subforums']"><div class="smallfont"><strong>$vbphrase[subforums]</strong>: $forum[subforums]</div></if>
        </td>
    </tr>
<if condition="!$show['collapsable_forums']">
</tbody>
</if>
<if condition="$childforumbits">
<if condition="!$show['collapsable_forums']">
<tbody id="collapseobj_forumbit_$forumid" style="{$collapseobj_forumid}">
</if>
$childforumbits
<if condition="!$show['collapsable_forums']">
</tbody>
</if>
</if>

Does anyone know how I can do this?

NOTE: (Here is an example of what I would like my category bar(s) to look like...)
__________________________________________________ ______________________
[__Category_Title___________________________Threads : X,XXX, Posts: XX,XXX__[^]_]


** Threads: X,XXX, Posts: XX,XXX = Total amount of Threads and Post from all sub-forums of the category.
** [^] = category collapse image

Lynne 04-07-2009 02:40 PM

You cannot put php in a template. You need to put the php into a plugin and then put the results from the plugin into your template.


All times are GMT. The time now is 11:33 AM.

Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.

X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.01097 seconds
  • Memory Usage 1,757KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (2)bbcode_html_printable
  • (3)bbcode_php_printable
  • (1)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (1)pagenav_pagelink
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (10)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • printthread_start
  • pagenav_page
  • pagenav_complete
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete