Guides & Snippets for phpBB3.
Try the Snippets here and share Your own Snippets
Post
by Stoker » 11 Mar 2010, 22:07
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:
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>
Post
by DoYouSpeakWak » 22 Mar 2010, 11:02
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 ?
Post
by Stoker » 22 Mar 2010, 12:08
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.
Post
by DoYouSpeakWak » 22 Mar 2010, 12:10
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 ?
Post
by Oliver » 22 Mar 2010, 12:17
What if the user has hidden there feel? What then is?
Post
by Stoker » 22 Mar 2010, 12:18
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.
Post
by Galandas » 13 Apr 2010, 12:24
you can also apply the style subsilver2? grazie
Post
by Steve » 13 Apr 2010, 14:30
open/styles/subsilver2/template/viewtopic_body.html
find:
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
Post
by Galandas » 13 Apr 2010, 15:56
thank you very much.....
Post
by SteffenWillers© » 06 May 2010, 20:58
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?