[Snippet] Static global logged in userlist V2

Little Mods and Snips 1

[Snippet] Static global logged in userlist V2

Postby Sekuro » 22 Apr 2012, 14:24

Static global logged in userlist V2

With this snippet you get a template variable, which shows a global logged in userlist everywhere as on Index
Normally the logged in userlist display is different in footer, if you go to forum, topic or wherever.

Credit: BNa

Screen:
on_2.png
on_2.png (462 Bytes) Viewed 1038 times

open

includes/functions.php

find

Code: Select all
    // The following assigns all _common_ variables that may be used at any point in a template.
    $template->assign_vars(array(


before add

Code: Select all
        // Static global logged in userlist / BNa / 2012
        $online_users_glob        = obtain_users_online(0, $item);
        $user_online_strings_glob = obtain_users_online_string($online_users_glob, 0, $item);
        $online_userlist_glob     = $user_online_strings_glob['online_userlist'];
        // Static global logged in userlist / BNa / 2012     


find

Code: Select all
        'LOGGED_IN_USER_LIST'            => $online_userlist


after add

Code: Select all
        // Static global logged in userlist / BNa / 2012
        'LOGGED_IN_USER_LIST_GLOB'        => (isset($online_userlist_glob)) ? $online_userlist_glob : false,
        // Static global logged in userlist / BNa / 2012                     


Now you can use {LOGGED_IN_USER_LIST_GLOB} in every template file

@ example:

open

styles/prosilver/template/overall_footer.html

find

Code: Select all
<div id="page-footer">


after add

Code: Select all
<!-- IF SCRIPT_NAME !== 'index' -->
    <
div class="navbar">
        <
div class="inner"><span class="corners-top"><span></span></span>

{
LOGGED_IN_USER_LIST_GLOB}

        <
span class="corners-bottom"><span></span></span></div>
    </
div>
    
<
div>&nbsp;</div>
<!-- ENDIF --> 


Dont forget to clear all board- and browser-caches after each template change
Mod-Bot / Service-Team
User avatar
Sekuro

Tiptop

Tiptop
 
Posts: 241
Joined: 11 Feb 2008, 11:49
 
Resolution: 1440x900


Return to Snip Cl@ss I

Who is online

Users browsing this forum: No registered users and 1 guest

cron