1

Topic: Online visitors

Hi All, I am a newbie on here, and new to coding and such. but I can follow directions smile

I am looking for a way to have online members shown, perhaps on sidebar. maybe 5 or 10. Any suggestions would be great!

Scott

2

Re: Online visitors

If you are new to the game, let me provide some background information before I discuss the coding.
You can customize vldPersonals templates to your liking. Your template folder is going to be located at root/templates/your template. If you stayed with the webby2 template than your path will be something like root/templaes/webby2.

In this post I will use webby2 as the template folder.

Open the webby2 folder and you will see your different template files. Templates end with the extension tpl.  For example: header.tpl,  footer.tpl, homepage.tpl, sidebar.tpl. You can use regular html and css coding to edit templates. Just remember to save them with the tpl extension.

There is one set of template files within your webby2 folder that has a unique purpose. They are called extensions. All extensions begin with ext. For example, if you look at your webby2 folder you will see these extensions: ext.blogs.tpl, ext.news.tpl, ext.members.tpl and so on.

Some of the extensions are used by default. Others you have to place the proper coding in a template to use. For example by default the ext.members.tpl is used to display new members on your site. If you open your homepage.tpl you will see the following coding:

{members:limit=20,photos=1,cache_time=0,cache_name="popular",orderby="ratings",orderdir="desc"}

What the above coding in your homepage.tpl does is CALL the ext.members.tpl and places the new members on your homepage.tpl. 

There is one other folder that comes in to play that most users will never touch unless they are a php programmer. It is located at includes/ext. To finish this example here is how it all works together:

1. includes/ext - contains the php files to retrieve and execute the required data from the database. For  example: includes/ext/ext.members.php will retrieve the required data for new members from the database

2. ext.members.tpl will format the data retrieved by ext.members.php

3. In turn, you can call the ext.members.tpl by placing the proper coding in a template. By default homepage.tpl calls ext.members.tpl with the following coding:

{members:limit=20,photos=1,cache_time=0,cache_name="popular",orderby="ratings",orderdir="desc"}

OK, that's the background info. There is no unique call  just for online visitors (at least not in 2.5.3). However, vldP allows you to  use existing extensions and adjust them with parameters. In our case we will adjust the coding for the new members extension by adding parameters to display online visitors.  To make a distinction between the above  call for new members we will call it NEW MEMBERS CALL and the call below for online visitors we will call ONLINE VISITORS CALL

{members:limit=50,photos=1,groups="2|9|10",cache_time=0,cache_name="regular",online="1",orderdir="desc",template="ext.members_side2.tpl"}

You can see that above ONLINE VISITOR call is using the ext.members.tpl because it starts out with members.

Lets look at the differences.

Both use limit=x - this tells how many images to display

Both use photos=1 - this tells the call to only display photos that are active

Both use cache_time=x - cache is a temp folder where repeated data is stored so it can quickly be retrieved by the computer. One draw back. If you cache time is set for 10 minutes and for example you make a change by adding or deleting an image, it may take 10 minutes before you can see the update.

Both use cache_name=x - always give each call a unique cache name. For example the cache name for NEW MEMBERS CALL is popular and the cache name for  ONLINE VISITOR CALL is regular. If both of the calls cache name were popular there would be a conflict between the two calls trying to use the same cache. To avoid the conflict, always give each call a unique cache name. It doens't matter what you name it, but keep it simple and one word.

NEW MEMBERS CALL - uses orderby telling how to display new members. In this case by rating.

Both use orderdir - telling what direction to display the images.

ONLINE VISITOR CALL - uses online=1 telling it to display only members online. This is the parameter that will do what you want.

ONLINE VISTOR CALL - has the groups=x parameter. If you want to display all groups, than do not use in the call. By default regular members id is 2 and admin id is 1. I saw no reason to display myself (admin) so  I told it to display  groups="2" -- regular members only. However, as time went on I created some new groups and I added those groups to be displayed  as well (as you can see the groups ids were 9 and 10).

ONLINE VISITOR CALL - template=x parameter is something I won't explain at this time. It's  a little more advanced and you may not need to use.

Now that we know about calls here  is what I would recommend.

Use this call:

{members:limit=50,photos=1,cache_time=0,cache_name="regular",online="1",orderdir="desc"}

Change the limit and cache name to what you want.

Put the above call in your sidebar.tpl if you want to display it on the side panel. If after you did the above call there are some format issues, let me know and I will look at it.

cheers
dan

Last edited by db3204 (2010-07-19 17:03:04)

3

Re: Online visitors

Thank you Dan for such a thorough explanation of .ext and calls. That sure helps me, and I'm sure others that are in a similar learning curve better understand how it all works together.

It is my desire, and ambition to learn this so I can become efficient. Sure, If I had the money I could just pay for the Mod's and design. I am more of a hands on person. I thank you for your patience, and sharing of your knowledge:)

Thank you again Dan,

Scott

4

Re: Online visitors

Thank you Dan it works like a charm. Ok my turn. Fixed...Solved...Done smile

5

Re: Online visitors

I think the following call will format your online members better

{members:limit=5,photos=1,cache_time=0,cache_name="regular",online="1",template="ext.members_online.tpl",orderdir="desc"}

Last edited by db3204 (2010-07-20 11:39:27)

6

Re: Online visitors

Dan Great! Works like a charm. Thank you again Sir!

7

Re: Online visitors

How can you make it horizontal instead of vertical listings? I tried to remove the <br> in the ext.members_online.tpl but that didn't work.