logo

Member
Member
Offline Offline
Posts: 46
SVN 663: Completely fixing the big_numbers panel, see inside

This post covers all the bugs with the big_numbers panel (that I could find), and how to fix them.

Add the panel Big Numbers and navigate to a page displaying it.

You'll get this:
Code:

Notice: Undefined variable: FUNCTIONS_LANG in C:!WebServerhtdocspanelsbig_numbersindex.php on line 31
Notice: Undefined variable: FUNCTIONS_LANG in C:!WebServerhtdocspanelsbig_numbersindex.php on line 32
Notice: Undefined variable: FUNCTIONS_LANG in C:!WebServerhtdocspanelsbig_numbersindex.php on line 33
Notice: Undefined variable: FUNCTIONS_LANG in C:!WebServerhtdocspanelsbig_numbersindex.php on line 37
Notice: Undefined variable: PANEL_LANG in C:!WebServerhtdocspanelsbig_numbersindex.php on line 40


To fix, there's the matter of missing language...

Create and Open:
Code:
panels/big_numbers/languages/en.php


Paste Contents:
Code:

<?php
/* eoCMS is a content management system written in php
    Copyright (C) 2007 - 2009  James Mortemore, Ryan Matthews
    http://www.eocms.com
   This work is licensed under the Creative Commons
   Attribution-Share Alike 3.0 United States License.
   To view a copy of this license, visit
   http://creativecommons.org/licenses/by-sa/3.0/us/
   or send a letter to Creative Commons, 171 Second Street,
   Suite 300, San Francisco, California, 94105, USA.
   Additional license terms at http://eocms.com/license.html
   
   FWishbringer 25/09/2009
*/
$PANEL_LANG = array();

$PANEL_LANG["bn_title"]         = 'Big Numbers';
$PANEL_LANG['bn_threads']          = 'Total Threads';
$PANEL_LANG['bn_posts']            = 'Total Posts';
$PANEL_LANG['bn_messages_sent']    = 'Total Messages';
$PANEL_LANG['bn_articles']         = 'Total Articles';

?>


Now that language is created, time to plug it in. Due to how I made the language file, it's simple enough.

Open
Code:
/panels/big_numbers/index.php


Replace All
Code:
FUNCTIONS_LANG['

With
Code:
PANEL_LANG['bn_


Next up, making the numbers fill in right.

First off, since autoincrement always increments to the next higher number, can flip, and doesn't reset on a deleted field: using max id is not really the best option in my opinion.

So....

Open: (Yes, again... perhaps its still open?)
Code:
panels/big_numbers/index.php


Find:
Code:

$_bn_articles = call('sql_query','SELECT max(id) AS numids FROM articles', $_bn_cache);
$_bn_articles = $_bn_articles[0][0];
$_bn_threads = call('sql_query','SELECT max(topic_id) AS numids FROM forum_topics', $_bn_cache);
$_bn_threads = $_bn_threads[0][0];
$_bn_posts = call('sql_query','SELECT max(id) AS numids FROM forum_posts', $_bn_cache);
$_bn_posts = $_bn_posts[0][0];
$_bn_pms = call('sql_query','SELECT max(id) AS numids FROM pm', $_bn_cache);
$_bn_pms = $_bn_pms[0][0];


Replace With:
Code:

$_bn_articles = call('sql_query','SELECT * FROM `articles`', $_bn_cache);
$_bn_articles = mysql_num_rows($_bn_articles);
$_bn_threads = call('sql_query','SELECT * FROM `forum_topics`', $_bn_cache);
$_bn_threads = mysql_num_rows($_bn_threads);
$_bn_posts = call('sql_query','SELECT * FROM `forum_posts`', $_bn_cache);
$_bn_posts = mysql_num_rows($_bn_posts);
$_bn_pms = call('sql_query','SELECT * FROM `pm`', $_bn_cache);
$_bn_pms = mysql_num_rows($_bn_pms);


This will give big, accurate numbers.

And done.

Big Numbers should now work 100%, with language file for easy adjusting.
Last Edit: 25th September, 2009, 02:39:03 PM by FWishbringer
eoCMS Developer
eoCMS Developer
Offline Offline
avatar
Posts: 1528
Re: SVN 663: Completely fixing the big_numbers panel, see inside

Done

Please do not PM me requesting support or anything, use the forums, thats what they are here for
eoCMS Designer
eoCMS Designer
Offline Offline
avatar
Posts: 1290
tbarkass_willamson@hotmail.com
Re: SVN 663: Completely fixing the big_numbers panel, see inside

This bug has been deemed [Fixed] by an eoCMS developer. If you dispute the Fix, please PM a developer, giving details of why. This topic can then be unlocked allowing for further discussion.

Seen a bug? Report it!

Jump to:


0.06 seconds Queries: 13