The forum of the forums
Would you like to react to this message? Create an account in a few clicks or log in to continue.

javascript to split the online users so i can style each one in css

2 posters

Go down

Solved javascript to split the online users so i can style each one in css

Post by _Twisted_Mods_ 11/10/2014, 15:38

i want to take the online users and split them and give each one a class so i can style each one in my css to make a custom online users section

Example

take this

In total there is 1 user online :: 1 Registered, 0 Hidden and 0 Guests



make it like this


<div class="users1">1 Registered</div>
<div class="users2">0 Hidden</div>
<div class="users3">0 Guests</div>


i have tried to figure this out on my own but i am not very good at js yet
_Twisted_Mods_
_Twisted_Mods_
Helper
Helper

Male Posts : 2108
Reputation : 336
Language : English
Location : Ms

http://liquidcode.forumotion.com

Back to top Go down

Solved Re: javascript to split the online users so i can style each one in css

Post by Ange Tuteur 11/10/2014, 15:46

Hello thetwistedkilla,

Could you provide what forum version you're using ?

Thanks Smile
Ange Tuteur
Ange Tuteur
Forumaster

Male Posts : 13246
Reputation : 3000
Language : English & 日本語
Location : Pennsylvania

https://fmdesign.forumotion.com

Back to top Go down

Solved Re: javascript to split the online users so i can style each one in css

Post by _Twisted_Mods_ 11/10/2014, 15:50

Hem it says on my profile on side but its phpbb2 ..but it dont matter what version u do it under i can switch the elements to the correct ones if you do it for a different version
_Twisted_Mods_
_Twisted_Mods_
Helper
Helper

Male Posts : 2108
Reputation : 336
Language : English
Location : Ms

http://liquidcode.forumotion.com

Back to top Go down

Solved Re: javascript to split the online users so i can style each one in css

Post by Ange Tuteur 11/10/2014, 16:15

Sorry, I like to make sure since members tend to have multiple forums. Wink

Go to Administration Panel > Display > Templates > General > index_body

Find :
Code:
<tr>
 <td class="row1"><span class="gensmall">{TOTAL_USERS_ONLINE}<br />
 {RECORD_USERS}<br />
 <br />
 {LOGGED_IN_USER_LIST}</span></td>
 </tr>

Replace by :
Code:
<tr>
          <td class="row1"><span id="whois-on" class="gensmall">{TOTAL_USERS_ONLINE}<br />
 {RECORD_USERS}<br />
 <br />
 {LOGGED_IN_USER_LIST}</span>
                <script type="text/javascript">(function() {
                  var who = document.getElementById('whois-on');
                  who.innerHTML = who.innerHTML.replace(/(\d+ Registered)/,'<span class="users1">$1</span>').replace(/(\d+ Hidden)/,'<span class="users2">$1</span>').replace(/(\d+ Guests)/,'<span class="users3">$1</span>');
                })();</script>
          </td>
 </tr>

Save and publish. Add

Then you should be able to style them with the classes you wanted. Smile
Ange Tuteur
Ange Tuteur
Forumaster

Male Posts : 13246
Reputation : 3000
Language : English & 日本語
Location : Pennsylvania

https://fmdesign.forumotion.com

Back to top Go down

Solved Re: javascript to split the online users so i can style each one in css

Post by _Twisted_Mods_ 11/10/2014, 16:27

ty that works awesome...solved.. i think i can figure out rest now im try put it in tables and so on ... if u leave this open ill post my finished result or you can close it and ill send it to you and you can make a tutorial out of it or something
_Twisted_Mods_
_Twisted_Mods_
Helper
Helper

Male Posts : 2108
Reputation : 336
Language : English
Location : Ms

http://liquidcode.forumotion.com

Back to top Go down

Solved Re: javascript to split the online users so i can style each one in css

Post by Ange Tuteur 11/10/2014, 16:29

You're welcome. ^^

Topic archived
Ange Tuteur
Ange Tuteur
Forumaster

Male Posts : 13246
Reputation : 3000
Language : English & 日本語
Location : Pennsylvania

https://fmdesign.forumotion.com

Back to top Go down

Back to top

- Similar topics

 
Permissions in this forum:
You cannot reply to topics in this forum