vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vBulletin 3.0 Full Releases (https://vborg.vbsupport.ru/forumdisplay.php?f=33)
-   -   [Addon] cinq's vbArticles Hack v2.0 - Show number of articles per category (https://vborg.vbsupport.ru/showthread.php?t=79551)

DRJ 04-06-2005 10:00 PM

[Addon] cinq's vbArticles Hack v2.0 - Show number of articles per category
 
A small addon to show the number of articles in each category.
This addon is for cinq's vbArticles Hack v2.0

Hack version 1.0

Files to edit: 1
articles.php

Templates to edit: 2
vbArticles_categorybit
vbArticles_childcatbit

Install instructions
===========================================

File Edits

articles.php

Find
PHP Code:

$catlistbit='';
if(!empty(
$cat_cache))
{
foreach (
$cat_cache[0] AS $parentcatrow)
{
         
$parentid $parentcatrow["articles_categoryid"];
         
$catname $parentcatrow["categoryname"];
         
$parentcat $parentcatrow["parentcategory"]; 

Replace with
PHP Code:

$catlistbit='';
if(!empty(
$cat_cache))
{
foreach (
$cat_cache[0] AS $parentcatrow)
{
         
$parentid $parentcatrow["articles_categoryid"];
         
$catname $parentcatrow["categoryname"];
         
$parentcat $parentcatrow["parentcategory"];
                
$cattotal 0;
$catcount $DB_site->query("
SELECT *
FROM " 
TABLE_PREFIX "articles_article
WHERE categoryid =
$parentid 
AND usersubmitted=0
And draft = 0
"
);
$cattotal $DB_site->num_rows($catcount); 

Find
PHP Code:

         if(!empty($cat_cache[$parentid]))
{
         foreach (
$cat_cache[$parentid] AS $subcatrow)
         {
             
$subcatid=$subcatrow["articles_categoryid"];
             
$subcatname=$subcatrow["categoryname"]; 

Replace with
PHP Code:

         if(!empty($cat_cache[$parentid]))
{
         foreach (
$cat_cache[$parentid] AS $subcatrow)
         {
             
$subcatid=$subcatrow["articles_categoryid"];
             
$subcatname=$subcatrow["categoryname"];
$cattotal 0;
$catcount $DB_site->query("
SELECT *
FROM " 
TABLE_PREFIX "articles_article
WHERE categoryid =
$subcatid
AND usersubmitted=0
And draft = 0
"
);
$cattotal $DB_site->num_rows($catcount); 

End File Edits

Template Edits

vbArticles_categorybit

Replace existing code with this
PHP Code:

<if condition="$parentcat==0"><br>
<
a href="articles.php?action=viewcat&catid=$parentid"><span class="smallfont"><b>$catname</b></a> ($cattotal)</span>
</if> 

vbArticles_childcatbit


Replace existing code with this
PHP Code:

<li><span class="smallfont"><a href="articles.php?action=viewcat&catid=$subcatid">$subcatname</a> ($cattotal)</span></li

End Template Edits

You can see a demo of this mod here: http://www.vbaexpress.com/forum/articles.php

Lee 04-07-2005 05:47 PM

the 2 template edits are identical - am I missing something?

DRJ 04-07-2005 05:53 PM

Copy/Paste error. I fixed it now. Thanks :)

Lee 04-07-2005 05:54 PM

I have installed the hack as shown (without the 2nd template edit possibly) and here it is http://www.cruiselineforums.com/foru...sereviews.php?

It shows some () without numbers. Is this because I don't have the 2nd template edit done?

Thanks!

Lee 04-07-2005 05:56 PM

Okay, now I have () on all categories and subs, but no numbers. Will this just pull in newly submitted articles?

Lee 04-07-2005 06:07 PM

it is working now - thanks!

*clicks install*

nexialys 04-07-2005 06:13 PM

would be good to be added to the next release instead of a hack... good work, i like precise counts!

DRJ 04-07-2005 06:33 PM

Glad you got it working speedpro :)

Thanks nexialys :)

kall 04-07-2005 07:38 PM

Da.

Gut! :)

I suggested this waaay back. Good stuff mr (mrs?) DRJ. :)

Viks 04-08-2005 02:17 PM

very cool


All times are GMT. The time now is 10:04 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.01221 seconds
  • Memory Usage 1,754KB
  • 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
  • (6)bbcode_php_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