vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   Modification Requests/Questions (Unpaid) (https://vborg.vbsupport.ru/forumdisplay.php?f=112)
-   -   Online users counter... (https://vborg.vbsupport.ru/showthread.php?t=43432)

leon2u 09-11-2002 03:43 PM

Online users counter...
 
1 Attachment(s)
Hai there,

I want to have the online users amount in the right top corner of my forum. The template that arranges that is called forumhome_welcometext . So what I did was a copy of $totonline from the template forumhome_loggedinusers to my forumhome_welcometext but the amount of users does not show.

See snapshot plz...the amount of users online should be mentioned between the words "zijn" en "gebruikers"

What code do I need to assign to index.php so that I can use the $totalonline variable in my template forumhome_welcometext

Plz help...

Webmasta XT 09-11-2002 11:41 PM

ok, I know the coding, I will contact u back as soon as I get it..

Webmasta XT 09-12-2002 12:11 AM

PHP Code:

// Find this code in index.php

eval("\$loggedinusers = \"".gettemplate('forumhome_loggedinusers')."\";");
}


// Replace it with this

  
eval("\$loggedinusers = \"".gettemplate('forumhome_loggedinusers')."\";");
  if (
$bbuserinfo['userid']!=0) {
  
$username=$bbuserinfo['username'];
eval(
"\$welcometext = \"".gettemplate('forumhome_welcometext')."\";");

} else {
  
$welcometext "";
  eval(
"\$unregwelcomemessage = \"".gettemplate('forumhome_unregmessage')."\";");
}
   }

// Place [B][COLOR=red]$totalonline[/COLOR][/B] in your welcometext template it would work for sure without problems. 

Working Demo @ http://www.xtreme-forumz.net/index.php

leon2u 09-12-2002 05:44 AM

It works flawlessly....but I have one thing more to ask to you. I worked two hours on it for trying it to get to work. Could you me explain every line of code what it does? Correct me plz if my thoughts of the code are wrong...

eval("\$loggedinusers = \"".gettemplate('forumhome_loggedinusers')."\"; ");
Here I assum a template get assigned to the
variable $loggedinusers???


if ($bbuserinfo['userid']!=0) {
$username=$bbuserinfo['username'];
!= means???
$username gets assigned to $bbuserinfo['username'] but what does this code $bbuserinfo['username'] do?

eval("\$welcometext = \"".gettemplate('forumhome_welcometext')."\";") ;
Assigning a template again I assume

} else { Ok, this is a part of the IF then ELSE statement

$welcometext = "";
What does this mean and why did you do it?

eval("\$newposts = \"".gettemplate('forumhome_todayposts')."\";");
eval("\$logincode = \"".gettemplate('forumhome_logincode')."\";");

Why do you assign these both eval lines??


Hope you are willing to learn me some code...

FlyingDutchman 09-12-2002 01:31 PM

  • 1st line: when '$loggedinusers' is called from a template, it will show the template 'forumhome_loggedinusers' at that place.
  • 2nd line(s): It checks if your a user (actually checks if you are NOT userid 0 - != means 'not equal to'), and if so it will assign your username (which is stored in $bbuserinfo['username']) to $username.
  • 3rd line: Same principe as 1st.
  • 4th line: You're right about the if-else statement stuff :).
  • 5th line: It basicly assigns a string of nothing between the "s is nothing. It's because if you would open it and the userid IS EQUAL TO 0, then it would just show '$welcometext' on your page instead of nothing (because it doesn't 'know' the variable).
  • 6th line(s): you assign these both, because they're both for a other variable, you'll need a new eval-line for every variable you want to assign a template to.

I've tried to explain it in easy language :) - I hope I helped you with this...
I guess you are dutch, but i'm not sure, so if you still need help, then I can also explain in dutch if you want ;)

leon2u 09-12-2002 07:22 PM

I am DUTCH indeed, are you DUTCH too???

Thanx for your explaining...

FlyingDutchman 09-13-2002 04:30 AM

yes, i am dutch.

Webmasta XT 09-14-2002 11:52 AM

I am sry but somehow, it posted the old coding, I am sure i changed the coding, but it was showing the old coding, I changed the coding again, sry..

Webmasta XT 09-14-2002 11:55 AM

These 2 lines shouldn't be there
PHP Code:

eval("\$newposts = \"".gettemplate('forumhome_todayposts')."\";");
eval(
"\$logincode = \"".gettemplate('forumhome_logincode')."\";"); 

Instead it should be
PHP Code:

eval("\$unregwelcomemessage = \"".gettemplate('forumhome_unregmessage')."\";"); 


leon2u 09-15-2002 02:44 PM

Why should those 2 lines not be there???

I had those lines there and worked fine...I changed it because you said so but now I am asking why is that? Could you explain it 2 me?

Thanx anyway for your effort...


All times are GMT. The time now is 10:49 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.00996 seconds
  • Memory Usage 1,747KB
  • 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
  • (3)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