HTML Logo by World Wide Web Consortium (www.w3.org). Click to learn more about our commitment to accessibility and standards.

Moving forward with Composr

ocPortal has been relaunched as Composr CMS, which is now in beta. ocPortal 9 will be superseded by Composr 10.

Head over to compo.sr for our new site, and to our migration roadmap. Existing ocPortal member accounts have been mirrored.


Stats problem.

Login / Search

 [ Join | More ]
 Add topic 
Posted
Rating:
#28316 (In Topic #6508)
Avatar

Community saint

I am having trouble getting rid of ∙
Users online:
∙∙ On site: 1 (max: 2)   
∙∙ On forums: 2    

from the stats.
I have been playing around with the side_stats.php file and I keep ending up with errors.

I run http://otakuplayground.com and am hopping to make themes and other things for ocportal even though I no longer use it for otakuplayground.com I still love it and feel it could go far with the right help. It needs themes and needs people to advertise for it.
Back to the top
 
Posted
Rating:
#28323
Avatar

Community saint

Here is what I tried.
Removed.

Code

      // Inbuilt
      $bits=new ocp_tempcode();
      $on_forum=$GLOBALS['FORUM_DRIVER']->get_num_users_forums();
      if (!is_null($on_forum))
      {
         $bits->attach(do_template('BLOCK_SIDE_STATS_SUBLINE',array('_GUID'=>'5ac97313d4c83e8afdeec09a48cea030','KEY'=>do_lang('COUNT_ONSITE'),'VALUE'=>do_lang('MEMBER_PEAKING',number_format(get_num_users_site()),number_format(get_num_users_peak())))));
         $bits->attach(do_template('BLOCK_SIDE_STATS_SUBLINE',array('_GUID'=>'14f2fdbf59e86c34d93cbf16bed3f0eb','KEY'=>do_lang('COUNT_ONFORUMS'),'VALUE'=>number_format($on_forum))));
         $full_tpl=do_template('BLOCK_SIDE_STATS_SECTION',array('_GUID'=>'7f5eba8caf808aef11c90ce8e9132790','SECTION'=>do_lang('SECTION_USERS'),'CONTENT'=>$bits));
      } else
      {
         $bits->attach(do_template('BLOCK_SIDE_STATS_SUBLINE',array('_GUID'=>'9c9760b2ed9e985e96b53c91c511e84e','KEY'=>do_lang('USERS_ONLINE'),'VALUE'=>do_lang('MEMBER_PEAKING',number_format(get_num_users_site()),number_format(get_num_users_peak())))));
         $full_tpl=do_template('BLOCK_SIDE_STATS_SECTION',array('_GUID'=>'e2408c71a7c74f1d14089412d4538b6d','SECTION'=>do_lang('ACTIVITY'),'CONTENT'=>$bits));

      }
And I get an error.
SO I then just removed parts of it.
I removed

Code

      if (!is_null($on_forum))
      {
         $bits->attach(do_template('BLOCK_SIDE_STATS_SUBLINE',array('_GUID'=>'5ac97313d4c83e8afdeec09a48cea030','KEY'=>do_lang('COUNT_ONSITE'),'VALUE'=>do_lang('MEMBER_PEAKING',number_format(get_num_users_site()),number_format(get_num_users_peak())))));
         $bits->attach(do_template('BLOCK_SIDE_STATS_SUBLINE',array('_GUID'=>'14f2fdbf59e86c34d93cbf16bed3f0eb','KEY'=>do_lang('COUNT_ONFORUMS'),'VALUE'=>number_format($on_forum))));
         $full_tpl=do_template('BLOCK_SIDE_STATS_SECTION',array('_GUID'=>'7f5eba8caf808aef11c90ce8e9132790','SECTION'=>do_lang('SECTION_USERS'),'CONTENT'=>$bits));
      } else
and I get no errors and it shows.
∙ Activity:
∙∙ Users online: 0 (max: 2)  
I then thought to my self ok getting closer.
so then removed

Code

         $bits->attach(do_template('BLOCK_SIDE_STATS_SUBLINE',array('_GUID'=>'9c9760b2ed9e985e96b53c91c511e84e','KEY'=>do_lang('USERS_ONLINE'),'VALUE'=>do_lang('MEMBER_PEAKING',number_format(get_num_users_site()),number_format(get_num_users_peak())))));
I then get
∙ Activity:
how ever thats all the farther I get and get and I can not figure out what else to remove to get that last little bit gone.



Last edit: by amichan

I run http://otakuplayground.com and am hopping to make themes and other things for ocportal even though I no longer use it for otakuplayground.com I still love it and feel it could go far with the right help. It needs themes and needs people to advertise for it.
Back to the top
 
Posted
Rating:
#28326
Avatar

Change lines 93-95 from:

Code

         $bits->attach(do_template('BLOCK_SIDE_STATS_SUBLINE',array('_GUID'=>'5ac97313d4c83e8afdeec09a48cea030','KEY'=>do_lang('COUNT_ONSITE'),'VALUE'=>do_lang('MEMBER_PEAKING',number_format(get_num_users_site()),number_format(get_num_users_peak())))));
         $bits->attach(do_template('BLOCK_SIDE_STATS_SUBLINE',array('_GUID'=>'14f2fdbf59e86c34d93cbf16bed3f0eb','KEY'=>do_lang('COUNT_ONFORUMS'),'VALUE'=>number_format($on_forum))));
         $full_tpl=do_template('BLOCK_SIDE_STATS_SECTION',array('_GUID'=>'7f5eba8caf808aef11c90ce8e9132790','SECTION'=>do_lang('SECTION_USERS'),'CONTENT'=>$bits));
to:

Code

         $full_tpl=new ocp_tempcode();

But please also remember to save your new file in the sources_custom/blocks directory, so that you aren't risking losing changes when you upgrade.


Become a fan of ocPortal on Facebook or add me as a friend. Add me on on Twitter.
Was I helpful?
  • If not, please let us know how we can do better (please try and propose any bigger ideas in such a way that they are fundable and scalable).
  • If so, please let others know about ocPortal whenever you see the opportunity.
  • If my reply is too Vulcan or expressed too much in business-strategy terms, and not particularly personal, I apologise. As a company & project maintainer, time is very limited to me, so usually when I write a reply I try and make it generic advice to all readers. I'm also naturally a joined-up thinker, so I always express my thoughts in combined business and technical terms. I recognise not everyone likes that, don't let my Vulcan-thinking stop you enjoying ocPortal on fun personal projects.
  • If my response can inspire a community tutorial, that's a great way of giving back to the project as a user.
Back to the top
 
Posted
Rating:
#28327
Avatar

Community saint

Do I keep the edits I did?

I run http://otakuplayground.com and am hopping to make themes and other things for ocportal even though I no longer use it for otakuplayground.com I still love it and feel it could go far with the right help. It needs themes and needs people to advertise for it.
Back to the top
 
Posted
Rating:
#28328
Avatar

Community saint

Ah wait that worked.

I run http://otakuplayground.com and am hopping to make themes and other things for ocportal even though I no longer use it for otakuplayground.com I still love it and feel it could go far with the right help. It needs themes and needs people to advertise for it.
Back to the top
 
Posted
Rating:
#28329
Avatar

An alternate method that involves only template edits would be…

BLOCK_SIDE_STATS_SECTION

Code

{+START,IF_NON_EMPTY,{CONTENT}}
<div>
   &#8729; {SECTION*}: <br />
   <div class="associated_link_to_small">
      {CONTENT}
   </div><br />
</div>
{+END}
This is to make empty stats section not show.

Then also…

BLOCK_SIDE_STATS_SUBLINE

Code

{+START,IF,{$AND,{$NEQ,{_GUID},5ac97313d4c83e8afdeec09a48cea030},{$NEQ,{_GUID},14f2fdbf59e86c34d93cbf16bed3f0eb}}}
&#8729;&#8729; {KEY*}: {VALUE*} <br />
{+END}
(so that the specific two hardcoded PHP lines don't actually result in any output).

You don't have to do this, but I thought it was a good opportunity to illustrate how our GUID system combines with Tempcode to allow some surprising things without having to change any PHP code.


Become a fan of ocPortal on Facebook or add me as a friend. Add me on on Twitter.
Was I helpful?
  • If not, please let us know how we can do better (please try and propose any bigger ideas in such a way that they are fundable and scalable).
  • If so, please let others know about ocPortal whenever you see the opportunity.
  • If my reply is too Vulcan or expressed too much in business-strategy terms, and not particularly personal, I apologise. As a company & project maintainer, time is very limited to me, so usually when I write a reply I try and make it generic advice to all readers. I'm also naturally a joined-up thinker, so I always express my thoughts in combined business and technical terms. I recognise not everyone likes that, don't let my Vulcan-thinking stop you enjoying ocPortal on fun personal projects.
  • If my response can inspire a community tutorial, that's a great way of giving back to the project as a user.
Back to the top
 
Posted
Rating:
#28336
Avatar

Community saint

well I already completely rewrote the template.
I now have it show each section side by side.
The main reason I have it this way is so I can have it in the middle and not on the side.



I run http://otakuplayground.com and am hopping to make themes and other things for ocportal even though I no longer use it for otakuplayground.com I still love it and feel it could go far with the right help. It needs themes and needs people to advertise for it.
Back to the top
 
There are too many online users to list.
Control functions:

Quick reply   Contract

Your name:
Your message: