Jump to content

Featured Replies

Posted
comment_169902

hi

I add this codes to show my custom statistics and every thing good works

{{$stats = array();}} {{$stats['total_posts'] = \IPS\Db::i()->select( "COUNT(*)", 'forums_posts', array( 'queued = ?', 0 ) )->first();}} {{if \IPS\Settings::i()->archive_on }} {{$stats['total_posts'] += \IPS\forums\Topic\ArchivedPost::db()->select( 'COUNT(*)', 'forums_archive_posts', array( 'archive_queued = ?', 0 ) )->first();}} {{endif}} {{$stats['total_topics'] = \IPS\Db::i()->select( "COUNT(*)", 'forums_topics', array( 'approved = ?', 1 ) )->first();}} {{$where = array( 'name<>? AND email<>?', '', '' );}} {{$stats['member_count'] = \IPS\Db::i()->select( 'COUNT(*)', 'core_members', $where )->first();}} {{$count = \IPS\Db::i()->select( 'COUNT(*)', 'core_sessions', array( 'login_type<>? and running_time > ?', \IPS\Session\Front::LOGIN_TYPE_SPIDER, \IPS\DateTime::create()->sub( new \DateInterval( 'PT30M' ) )->getTimeStamp() ) )->first();}} {{if $count > $mostOnline['count'] }} {{$mostOnline = array( 'count' => $count, 'time' => time() );}} {{\IPS\Db::i()->update( 'core_sys_conf_settings', array( 'conf_value' => json_encode( $mostOnline ) ), array( 'conf_key=?', 'most_online' ) );}} {{unset( \IPS\Data\Store::i()->settings );}} {{endif}} {{$stats['most_online'] = $mostOnline;}} {{$exclude = array();}} {{$where = array( "name IS NOT NULL AND name != '' AND temp_ban != -1 AND email != ''" );}} {{foreach \IPS\Member\Group::groups() as $id => $group}} {{if $group->g_hide_online_list}} {{$exclude[] = $group->g_id;}} {{endif}} {{endforeach}} {{if count( $exclude )}} {{$where[] = '( ! ( ' . \IPS\Db::i()->in( 'member_group_id', $exclude ) . ' ) )';}} {{endif}} {{$where[] = '( ! ' . \IPS\Db::i()->bitwiseWhere( \IPS\Member::$bitOptions['members_bitoptions'], 'bw_is_spammer' ) . ' )';}} {{$where[] = 'core_validating.new_reg IS NULL';}} {{$stats['last_registered'] = \IPS\Member::constructFromData( \IPS\Db::i()->select( 'core_members.*, core_validating.new_reg', 'core_members', array( implode( ' AND ', $where ) ), 'core_members.member_id DESC', array( 0, 1 ) )->join( 'core_validating', "core_validating.member_id=core_members.member_id" )->first() );}}

    <h3     class    =    'ipsType_reset ipsWidget_title ipsType_center'    >    
                    <span     class    =    'ips_stat'    >    {lang="total_topics"}     <span     class    =    'ips_static'    >    {number="$stats['total_topics']"}    </span></span>    
                    <span     class    =    'ips_stat'    >    {lang="total_posts"}     <span     class    =    'ips_static'    >    {number="$stats['total_posts']"}    </span></span>    
                    <span     class    =    'ips_stat'    >    {lang="stats_total_members"}     <span     class    =    'ips_static'    >    {number="$stats['member_count']"}    </span></span>                 
	                <span     class    =    'ips_stat'    >    {lang="stats_newest_member"}     <span     class    =    'ips_static'    >    {$stats['last_registered']->link()|raw}    </span></span>    
                    <span     class    =    'ips_stat'    >    {lang="stats_most_online"}     <span     class    =    'ips_static'     data-ipsTooltip     title    =    '{datetime="$stats['    most_online    ']['    time    ']" norelative="true"}'    >    {number="$stats['most_online']['count']"}    </span></span>    
</h3>    

but I want to display totalfiles but after adding, it returns 0 result. 

<span  class = 'ips_stat' > {lang="totalfiles"}  <span  class = 'ips_static' > {number="$stats['totalfiles']"} </span></span> 

I think $stats variable need

please help me!

comment_169963

add before <h3 class...

{{$stats['total_files'] = \IPS\Db::i()->select( "COUNT(*)", 'downloads_files', array( 'file_open = ?', 1 ) )->first();}}

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.


Guest
Ответить в этой теме...

Последние посетители 0

  • No registered users viewing this page.