Page 1 of 2

Online/Offline Text Info

Posted: 12 Mar 2010, 00:07
by Stoker
Online/Offline Text Info
Written by Stoker, inspired by DoYouSpeakWak??

This phpBB3 snippet will show you how to display Online/Offline text in viewtopic and profile.
Demo: this board.

Open styles/prosilver/template/viewtopic_body.html
Find:

Code: Select all

<!-- IF postrow.POSTER_POSTS != '' --><dd><strong>{L_POSTS}:</strong> {postrow.POSTER_POSTS}</dd><!-- ENDIF -->
Before add:

Code: Select all

<dd><strong>Status:</strong><!-- IF postrow.S_ONLINE --><span style="color:#008000; font-weight:bold;"> {L_ONLINE}:</span><!-- ELSE --><span style="color:#FF0000; font-weight:bold;"> {L_OFFLINE}:</span><!-- ENDIF --></dd>
Open styles/prosilver/template/memberlist_view.html
Find:

Code: Select all

<dt>{L_USERNAME}:</dt>
Before add:

Code: Select all

<dt>Status:</dt><dd><!-- IF S_ONLINE --><span style="color:#008000; font-weight:bold;"> {L_ONLINE}:</span><!-- ELSE --><span style="color:#FF0000; font-weight:bold;"> {L_OFFLINE}:</span><!-- ENDIF --></dd>

Re: Online/Offline Text Info

Posted: 22 Mar 2010, 13:02
by DoYouSpeakWak
Thought a bit about this last night. I was sure that online and offline pure text allready was in the language files. So no need for hardcoding and translation problems.

I was right. common.php

Code: Select all

	'OCCUPATION'				=> 'Occupation',
	'OFFLINE'					=> 'Offline',
	'ONLINE'					=> 'Online',
So if im not mistaken this

Code: Select all

<dd><strong>Status:</strong><!-- IF postrow.S_ONLINE --><span style="color:#008000; font-weight:bold;"> Online</span><!-- ELSE --><span style="color:#FF0000; font-weight:bold;"> Offline</span><!-- ENDIF --></dd>
Can look like this

Code: Select all

<dd><strong>Status:</strong><!-- IF postrow.S_ONLINE --><span style="color:#008000; font-weight:bold;"> {L_ONLINE}</span><!-- ELSE --><span style="color:#FF0000; font-weight:bold;"> {L_OFFLINE}</span><!-- ENDIF --></dd>
And this

Code: Select all

<dt>Status:</dt><dd><!-- IF S_ONLINE --><span style="color:#008000; font-weight:bold;">Online</span><!-- ELSE --><span style="color:#FF0000; font-weight:bold;">Offline</span><!-- ENDIF --></dd>
like this

Code: Select all

<dt>Status:</dt><dd><!-- IF S_ONLINE --><span style="color:#008000; font-weight:bold;">{L_ONLINE}</span><!-- ELSE --><span style="color:#FF0000; font-weight:bold;">{L_OFFLINE}</span><!-- ENDIF --></dd>
An the private messages in ucp is not covered by this. Should they be ?

Re: Online/Offline Text Info

Posted: 22 Mar 2010, 14:08
by Stoker
You will still be missing the word "'Status:"
This is the easiest way I could figure out doing this, 2 template changes and you have got it.
But offcourse, if we are talking coding guidelines you never hardcode templates.

Re: Online/Offline Text Info

Posted: 22 Mar 2010, 14:10
by DoYouSpeakWak
I missed that. Its no biggie. But a language/common.php might be the best solution.

What about adding this to the ucp ? What do you think about that ?

Re: Online/Offline Text Info

Posted: 22 Mar 2010, 14:17
by Oliver
What if the user has hidden there feel? What then is?

Re: Online/Offline Text Info

Posted: 22 Mar 2010, 14:18
by Stoker
I think it would be nice with an extended version, properly coded so it can be translated and used in several languages.
But then its more a mod than a snippet.
Feel free to post it in the support area, then I will move it to the mods forum.

Re: Online/Offline Text Info

Posted: 13 Apr 2010, 14:24
by Galandas
you can also apply the style subsilver2? grazie

Re: Online/Offline Text Info

Posted: 13 Apr 2010, 16:30
by Steve
open/styles/subsilver2/template/viewtopic_body.html
find:

Code: Select all

<span class="postdetails">
add after:

Code: Select all

<b>Status:</b><!-- IF postrow.S_ONLINE --><span style="color:#008000; font-weight:bold;"> Online</span><!-- ELSE --><span style="color:#FF0000; font-weight:bold;"> Offline</span><!-- ENDIF -->
open styles/subsilver2/template/mamberslist_view.html
find:

Code: Select all

			<!-- IF AVATAR_IMG -->
				<tr>
					<td align="center">{AVATAR_IMG}</td>
				</tr>
			<!-- ENDIF -->
add after:

Code: Select all

			<tr>
    			<td><b>Status:</b><!-- IF S_ONLINE --><span style="color:#008000; font-weight:bold;">{L_ONLINE}</span><!-- ELSE --><span style="color:#FF0000; font-weight:bold;">{L_OFFLINE}</span><!-- ENDIF --></td>
			</tr>
statuso.PNG
statusoo.PNG

Re: Online/Offline Text Info

Posted: 13 Apr 2010, 17:56
by Galandas
thank you very much..... :gp:

Re: Online/Offline Text Info

Posted: 06 May 2010, 22:58
by SteffenWillers©
thanks for the Post but i have a quetion. What do you mean with the common.php with the codeI was right. common.php

Code: Select all

Code: Select all
       'OCCUPATION'            => 'Occupation',
       'OFFLINE'               => 'Offline',
       'ONLINE'               => 'Online',

So if im not mistaken this

Code: Select all

Code: Select all
    <dd><strong>Status:</strong><!-- IF postrow.S_ONLINE --><span style="color:#008000; font-weight:bold;"> Online</span><!-- ELSE --><span style="color:#FF0000; font-weight:bold;"> Offline</span><!-- ENDIF --></dd>


Can look like this

Code: Select all

Code: Select all
    <dd><strong>Status:</strong><!-- IF postrow.S_ONLINE --><span style="color:#008000; font-weight:bold;"> {L_ONLINE}</span><!-- ELSE --><span style="color:#FF0000; font-weight:bold;"> {L_OFFLINE}</span><!-- ENDIF --></dd>


And this

Code: Select all

Code: Select all
    <dt>Status:</dt><dd><!-- IF S_ONLINE --><span style="color:#008000; font-weight:bold;">Online</span><!-- ELSE --><span style="color:#FF0000; font-weight:bold;">Offline</span><!-- ENDIF --></dd>

like this

Code: Select all

Code: Select all
    <dt>Status:</dt><dd><!-- IF S_ONLINE --><span style="color:#008000; font-weight:bold;">{L_ONLINE}</span><!-- ELSE --><span style="color:#FF0000; font-weight:bold;">{L_OFFLINE}</span><!-- ENDIF --></dd>

where do I add code to what? Namely, I have no plan what needs to be stored where.
Sorry for my bad english. Can help me for my Problem?