Sorting logged_in_list

Author Message

Eivind Marienborg

Tuesday 10 August 2004 6:43:52 am

I'm having problmes sorting the logged_in_list using the following code:

{section var=user loop=fetch( 'user', 'logged_in_list', sort_by, 'login') }

I've also tried the following without any result:

{section var=user loop=fetch( 'user', 'logged_in_list', sort_by, array( 'login', false() ) ) }

Whatever what I do, the list ends up in random order. Any ideas?

Bård Farstad

Tuesday 10 August 2004 7:01:43 am

You need to supply the parameters with a hash array. This is done like this;

{section var=user loop=fetch( 'user', 'logged_in_list', hash( 'sort_by', 'login' ) ) }
{$user}
{/section}

That should work.

--bård

Documentation: http://ez.no/doc

Eivind Marienborg

Wednesday 11 August 2004 2:05:50 am

Well, this sorts the list fine, but it doesn't show all logged in users.. I also use the logged_in_count, and this sometimes return 10 logged in users, while the logged_in_list only show 6-7.

How come?

Bård Farstad

Wednesday 11 August 2004 2:41:47 am

That's strange. I just looked at the code and it should be the same logic used in both functions.

Is the same user logged in many times?

--bård

Documentation: http://ez.no/doc

Eivind Marienborg

Thursday 12 August 2004 4:16:27 am

It only misbehaves from time to time, and lately it has worked okay. Next time it occurs I'll investigate :)

Bård Farstad

Thursday 12 August 2004 6:53:06 am

Ok, keep us updated. If you notice something reproduceable we can fix it.

--bård

Documentation: http://ez.no/doc

Eivind Marienborg

Friday 03 September 2004 1:02:12 am

I had a similar problem again now, but this time it didn't show any of the logged in users in the list, they just showed up in the count. Clearing the cache fixed it, though.

Bård Farstad

Friday 03 September 2004 1:05:37 am

Eivind, please check if you have a {cache-block} around the logged in users list. This would cache the result and it will only be updated when any content changes. You can use the expiry parameter for cache blocks if you would like to e.g. make it expire/update every 15 minutes.

More information about cache blocks:
http://www.ez.no/ez_publish/documentation/reference/template_functions/miscellaneous/cache_block
http://www.ez.no/ez_publish/documentation/development/kernel/cache_block_optimization

--bård

Documentation: http://ez.no/doc

Eivind Marienborg

Friday 03 September 2004 1:10:28 am

No, there are no cache-blocks. But I refreshed the cache just before the error occured too. I've noticed that eZ doesn't seem to to handle my cache-refreshes very well all the time - Some times it doesn't read all the override templates, so I have to refresh again. I think this might've been what happened this time.

Eivind Marienborg

Friday 03 September 2004 2:12:07 am

There now seems to be trouble again.

I now have two templates with the user stats. One of them only shows the count, which is 2. The other shows both the count and the list, and here there are 3 in both the list and the count.

EDIT:
I think I've found what's wrong.. The list shows all users in the session, even though 1 of them has timed out, according to what I've set in the ActivityTimeout=600 in my site.ini.append. Don't know how to fix it, though..

Eivind Marienborg

Monday 13 September 2004 7:19:38 am

I'm beginning to believe that enabling ViewCaching in the site.ini.append is what causes the problems. So I red up on set-blocks (http://ez.no/ez_publish/documentation/incoming/how_to_set_cache_expire_time_or_disable_cache_in_template), and it seemed that this'd might solve my problem. But inserting {set-block scope=root variable=cache_ttl}1{/set-block} in the template doesn't do anything. I've versioned the template in a HTML-comment field, so I know the right template is being used.

So, any idea why {set-block scope=root variable=cache_ttl}1{/set-block} won't work? Again, the template is an override for the full.tpl.

Powered by eZ Publish™ CMS Open Source Web Content Management. Copyright © 1999-2014 eZ Systems AS (except where otherwise noted). All rights reserved.