PDA

View Full Version : Online users counter...


leon2u
09-11-2002, 03:43 PM
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
// 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 $totalonline 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

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


Instead it should be

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...

Webmasta XT
09-15-2002, 11:17 PM
because I installed that hack on my boards with the Welcome Panel, lol, and those 2 lines were there, i guess i copied them in a hurry, lol, but since u don't have a welcome panel, you don't need those there..

leon2u
09-16-2002, 05:26 AM
Webmasta XT ,

Could you create this hack for me?

See this thread:
https://vborg.vbsupport.ru/showthread.php?s=&threadid=43492