Board Viewers

Started by Yağız..., March 12, 2006, 05:42:17 PM

Previous topic - Next topic

Harzem

The needed code is just that part:

<b><a href="', $board['href'], '" name="b', $board['id'], '">', $board['name'], '</a></b><br />

Note: that was a quick response, I haven't looked at the theme files yet :)

bmhm

It doesn't show me the user who's viewing the board, it just shows a number!!

And i DID set the theme to show names...

Harzem

That is what it does. It shows the number of viewers of each board. The setting that you just changed is - not a mod feature! It is default SMF feature, which shows the numbers or member names inside each board.

The Board Viewers mod only uses the setting. If it is not set to "Don't show!", the mod shows numbers. The other two settings, numbers or names, doesn't affect the mod. This setting affects SMF when you go inside a board. Before the messages, it says either "10 users are viewing this board." or "HarzeM, bmhm, and 8 guests are viewing this board.". And this is a default feature of SMF.

"it just shows a number!!" is what the mod is designed to do ;)

However, I congratulate you ;), because you've guessed the new feature of Board Viewers 1.0 :D The next release will be able to show the names also, if you set the appropriate setting.

bmhm

Wow I never noticed there's a disply "x and 0 guests..." It's so tiny....  ::)

Hmm can I do a german translation so next time I can install it without having trouble? ;-)

just drop me an E-Mail...

Niteblade

#24
I get this error with manual install. v1.1RC2.
custom template

i installed the mod as normal, all went well... (default theme only.)
i then took a peek inside your xml file to see which files were changed and where so i could update my custom tempate.

Alas! - I dunno what to do !


Parse error: syntax error, unexpected '.' in .../Themes/TP_apollo11rc2/BoardIndex.template.php on line 170

161:                                 if (!empty($board['children']))
162:                                 {
163:                                         // Sort the links into an array with new boards bold so it can be imploded.
164:                                         $children = array();
165:                                         /* Each child in each board's children has:
166:                                                 id, name, description, new (is it new?), topics (#), posts (#), href, link, and last_post. */
167:                                         foreach ($board['children'] as $child)
168:                                         {
169:                                                
170: /*Board Viewers - by HarzeM*/ . (($child['viewers'] > 0 ) ?  ', ' . $child['viewers'] . (($child['viewers'] > 1) ? $txt['board_viewers'] : $txt['board_viewer']) : '' )171: $child['link'] = '<a href="' . $child['href'] . '" title="' . ($child['new'] ? $txt[333] : $txt[334]) . ' (' . $txt[330] . ': ' . $child['topics'] . ', ' . $txt[21] . ': ' . $child['posts'] . ')">' . $child['name'] . '</a>';
172:                                                 $children[] = $child['new'] ? '<b>' . $child['link'] . '</b>' : $child['link'];
173:                                         }
174:


boardindex.template.php
http://rapidshare.de/files/16840004/BoardIndex.template.zip.html
affiliate blog

Harzem

If you give a link to your original file also, I can have a better look at the problem.

Niteblade

I attached the file via rapidshare.

The original file would be that same file minus the Harzem added info.
affiliate blog

Harzem

I think you have added the line to a wrong place.

                        <b><a href="', $board['href'], '" name="b', $board['id'], '">', $board['name'], '</a></b><br />
' , /*Board Viewers - by HarzeM*/($board['viewers'] > 0 ) ? '<span class="smalltext" style="float:right;"> (<b>'.$board['viewers'] . '</b> ' . (($board['viewers'] > 1) ? $txt['board_viewers'] : $txt['board_viewer']) . ')</span>' : '' , '


should be >


' , /*Board Viewers - by HarzeM*/($board['viewers'] > 0 ) ? '<span class="smalltext" style="float:right;"> (<b>'.$board['viewers'] . '</b> ' . (($board['viewers'] > 1) ? $txt['board_viewers'] : $txt['board_viewer']) . ')</span>' : '' , '
                        <b><a href="', $board['href'], '" name="b', $board['id'], '">', $board['name'], '</a></b><br />

Niteblade

When this is used

<td align="left">
                        ' , /*Board Viewers - by HarzeM*/($board['viewers'] > 0 ) ? '<span class="smalltext" style="float:right;"> (<b>'.$board['viewers'] . '</b> ' . (($board['viewers'] > 1) ? $txt['board_viewers'] : $txt['board_viewer']) . ')</span>' : '' , '
                                         
                        <b><a href="', $board['href'], '" name="b', $board['id'], '">', $board['name'], '</a></b><br />
                        ', $board['description'];
                                // Show the "Moderators: ".  Each has name, href, link, and id. (but we're gonna use link_moderators.)
                                if (!empty($board['moderators']))
                                        echo '
                        <div style="padding-top: 1px;" class="smalltext"><i>', count($board['moderators']) == 1 ? $txt[298] : $txt[299], ': ', implode(', ', $board['link_moderators']), '</i></div>';

                                // Show the "Child Boards: ". (there's a link_children but we're going to bold the new ones...)
                                if (!empty($board['children']))
                                {
                                        // Sort the links into an array with new boards bold so it can be imploded.
                                        $children = array();
                                        /* Each child in each board's children has:
                                                id, name, description, new (is it new?), topics (#), posts (#), href, link, and last_post. */
                                        foreach ($board['children'] as $child)
                                        {
                                               
/*Board Viewers - by HarzeM*/ . (($child['viewers'] > 0 ) ?  ', ' . $child['viewers'] . (($child['viewers'] > 1) ? $txt['board_viewers'] : $txt['board_viewer']) : '' )
$child['link'] = '<a href="' . $child['href'] . '" title="' . ($child['new'] ? $txt[333] : $txt[334]) . ' (' . $txt[330] . ': ' . $child['topics'] . ', ' . $txt[21] . ': ' . $child['posts'] . ')">' . $child['name'] . '</a>';
                                                $children[] = $child['new'] ? '<b>' . $child['link'] . '</b>' : $child['link'];
                                        }

                                        echo '
                        <div style="padding-top: 1px;" class="smalltext"><i>', $txt['parent_boards'], ': ', implode(', ', $children), '</i></div>';
                                }


The result is this :


Parse error: syntax error, unexpected '.' in .../Themes/TP_apollo11rc2/BoardIndex.template.php on line 168

159:                                 if (!empty($board['children']))
160:                                 {
161:                                         // Sort the links into an array with new boards bold so it can be imploded.
162:                                         $children = array();
163:                                         /* Each child in each board's children has:
164:                                                 id, name, description, new (is it new?), topics (#), posts (#), href, link, and last_post. */
165:                                         foreach ($board['children'] as $child)
166:                                         {
167:                                                 
168: /*Board Viewers - by HarzeM*/ . (($child['viewers'] > 0 ) ?  ', ' . $child['viewers'] . (($child['viewers'] > 1) ? $txt['board_viewers'] : $txt['board_viewer']) : '' )169: $child['link'] = '<a href="' . $child['href'] . '" title="' . ($child['new'] ? $txt[333] : $txt[334]) . ' (' . $txt[330] . ': ' . $child['topics'] . ', ' . $txt[21] . ': ' . $child['posts'] . ')">' . $child['name'] . '</a>';
170:                                                 $children[] = $child['new'] ? '<b>' . $child['link'] . '</b>' : $child['link'];
171:                                         }
172:


When this, on the other hand, is used

<td align="left">                                                               
                        <b><a href="', $board['href'], '" name="b', $board['id'], '">', $board['name'], '</a></b><br />
                        ' , /*Board Viewers - by HarzeM*/($board['viewers'] > 0 ) ? '<span class="smalltext" style="float:right;"> (<b>'.$board['viewers'] . '</b> ' . (($board['viewers'] > 1) ? $txt['board_viewers'] : $txt['board_viewer']) . ')</span>' : '' , '
                        ', $board['description'];
                                // Show the "Moderators: ".  Each has name, href, link, and id. (but we're gonna use link_moderators.)
                                if (!empty($board['moderators']))
                                        echo '
                        <div style="padding-top: 1px;" class="smalltext"><i>', count($board['moderators']) == 1 ? $txt[298] : $txt[299], ': ', implode(', ', $board['link_moderators']), '</i></div>';

                                // Show the "Child Boards: ". (there's a link_children but we're going to bold the new ones...)
                                if (!empty($board['children']))
                                {
                                        // Sort the links into an array with new boards bold so it can be imploded.
                                        $children = array();
                                        /* Each child in each board's children has:
                                                id, name, description, new (is it new?), topics (#), posts (#), href, link, and last_post. */
                                        foreach ($board['children'] as $child)
                                        {
                                               
/*Board Viewers - by HarzeM*/ . (($child['viewers'] > 0 ) ?  ', ' . $child['viewers'] . (($child['viewers'] > 1) ? $txt['board_viewers'] : $txt['board_viewer']) : '' )
$child['link'] = '<a href="' . $child['href'] . '" title="' . ($child['new'] ? $txt[333] : $txt[334]) . ' (' . $txt[330] . ': ' . $child['topics'] . ', ' . $txt[21] . ': ' . $child['posts'] . ')">' . $child['name'] . '</a>';
                                                $children[] = $child['new'] ? '<b>' . $child['link'] . '</b>' : $child['link'];
                                        }

                                        echo '
                        <div style="padding-top: 1px;" class="smalltext"><i>', $txt['parent_boards'], ': ', implode(', ', $children), '</i></div>';
                                }


The result is this :

Parse error: syntax error, unexpected '.' in .../Themes/TP_apollo11rc2/BoardIndex.template.php on line 167

158:                                 if (!empty($board['children']))
159:                                 {
160:                                         // Sort the links into an array with new boards bold so it can be imploded.
161:                                         $children = array();
162:                                         /* Each child in each board's children has:
163:                                                 id, name, description, new (is it new?), topics (#), posts (#), href, link, and last_post. */
164:                                         foreach ($board['children'] as $child)
165:                                         {
166:                                                 
167: /*Board Viewers - by HarzeM*/ . (($child['viewers'] > 0 ) ?  ', ' . $child['viewers'] . (($child['viewers'] > 1) ? $txt['board_viewers'] : $txt['board_viewer']) : '' )168: $child['link'] = '<a href="' . $child['href'] . '" title="' . ($child['new'] ? $txt[333] : $txt[334]) . ' (' . $txt[330] . ': ' . $child['topics'] . ', ' . $txt[21] . ': ' . $child['posts'] . ')">' . $child['name'] . '</a>';
169:                                                 $children[] = $child['new'] ? '<b>' . $child['link'] . '</b>' : $child['link'];
170:                                         }
171:
affiliate blog

Harzem

The codes of the mod should not be there. You should not add the codes to the previous line of searched strings. You should exactly add before the search string in the mod file.


167: // empty
168: $child['link'] = '<a href="' . $child['href'] . '" title="' . ($child['new'] ? $txt[333] : $txt[334]) . ' (' . $txt[330] . ': ' . $child['topics'] . ', ' . $txt[21] . ': ' . $child['posts'] /*Board Viewers - by HarzeM*/ . (($child['viewers'] > 0 ) ?  ', ' . $child['viewers'] . (($child['viewers'] > 1) ? $txt['board_viewers'] : $txt['board_viewer']) : '' ) . ')">' . $child['name'] . '</a>';


Niteblade

I must be misinterpreting.

The XML file reads like this :

<file name="$themedir/BoardIndex.template.php">
<operation>
<search position="after"><![CDATA[<b><a href="', $board['href'], '" name="b', $board['id'], '">', $board['name'], '</a></b><br />]]></search>
<add><![CDATA[' , /*Board Viewers - by HarzeM*/($board['viewers'] > 0 ) ? '<span class="smalltext" style="float:right;"> (<b>'.$board['viewers'] . '</b> ' . (($board['viewers'] > 1) ? $txt['board_viewers'] : $txt['board_viewer']) . ')</span>' : '' , ']]></add>
</operation>

<operation>
<search position="before"><![CDATA[$child['link'] = '<a href="' . $child['href'] . '" title="' . ($child['new'] ? $txt[333] : $txt[334]) . ' (' . $txt[330] . ': ' . $child['topics'] . ', ' . $txt[21] . ': ' . $child['posts']]]></search>
<add><![CDATA[/*Board Viewers - by HarzeM*/ . (($child['viewers'] > 0 ) ?  ', ' . $child['viewers'] . (($child['viewers'] > 1) ? $txt['board_viewers'] : $txt['board_viewer']) : '' )]]></add>
</operation>


Therefore, I know that I need to edit "BoardIndex.template.php" for the particular theme I'm using. In my case, I'm using Tiny Portal with a Tiny Portal theme.

When I see
<search position="after"><![CDATA[<b><a href="', $board['href'], '" name="b', $board['id'], '">', $board['name'], '</a></b><br />]]></search>
, I interpret it as that I need to look for the string <b><a href="', $board['href'], '" name="b', $board['id'], '">', $board['name'], '</a></b><br /> inside the BoardIndex.template.php file. Naturally, I found the instance of the string. And when I saw the <search position = "after">, I took it that I should add ' , /*Board Viewers - by HarzeM*/($board['viewers'] > 0 ) ? '<span class="smalltext" style="float:right;"> (<b>'.$board['viewers'] . '</b> ' . (($board['viewers'] > 1) ? $txt['board_viewers'] : $txt['board_viewer']) . ')</span>' : '' , ' AFTER the string I searched for.

I used the same kind of thinking when I applied the Ad Management mod to my customized theme, and it worked with no problem.
affiliate blog

Harzem

the <search position = "after"> works in a funny way. You search for the string, and it is after! I mean, you should add the codes before it. You've just searched for a text which should be after the added code :)

Or am I wrong :S But my mod works perfectly with many people, so I must be right, I think :)

BTW, my name is "JayBachetero" for only a few minutes. I'm HarzeM in fact :D

Niteblade

Uh, how odd.

<search position = "after"> This means that I want the modified code to appear before the code that I searched for. The "after" refers to what must come after the modified code. To put this another way, the modified code must appear before the code I searched for.

modified or code to be added -- comes first.
original code that was searched for -- comes second.


<search position ="before"> This means that I want the modified code to appear after the code that I searched for. The "before" refers to what must come before the modified code. To put this in another way, the modified code must appear after the code I searched for.

original code that was searched for -- comes first.
modified or code to be added -- comes second.

Is this correct ?
affiliate blog

Harzem


Niteblade

Okay. I think the best thing to do is :
1. Install any mod via the package installer.
2. If the mod only supports the default theme, then 'view' the modified files references in the XML.
3. Now, compare those files that were modified in the default theme to the ones that need to be modified in your custom theme.

I think I got it working. Now I can see "1 Member and 0 Guests are viewing this board" .

In my custom theme file folder, I modified the boardindex.template.php file.

This is what works :

<td align="left">
' , /*Board Viewers - by HarzeM*/($board['viewers'] > 0 ) ? '<span class="smalltext" style="float:right;"> (<b>'.$board['viewers'] . '</b> ' . (($board['viewers'] > 1) ? $txt['board_viewers'] : $txt['board_viewer']) . ')</span>' : '' , '<b><a href="', $board['href'], '" name="b', $board['id'], '">', $board['name'], '</a></b><br />
                        ', $board['description'];

                                // Show the "Moderators: ".  Each has name, href, link, and id. (but we're gonna use link_moderators.)
                                if (!empty($board['moderators']))
                                        echo '
                        <div style="padding-top: 1px;" class="smalltext"><i>', count($board['moderators']) == 1 ? $txt[298] : $txt[299], ': ', implode(', ', $board['link_moderators']), '</i></div>';

                                // Show the "Child Boards: ". (there's a link_children but we're going to bold the new ones...)
                                if (!empty($board['children']))
                                {
                                        // Sort the links into an array with new boards bold so it can be imploded.
                                        $children = array();
                                        /* Each child in each board's children has:
                                                id, name, description, new (is it new?), topics (#), posts (#), href, link, and last_post. */
                                        foreach ($board['children'] as $child)
                                        {
                                                $child['link'] = '<a href="' . $child['href'] . '" title="' . ($child['new'] ? $txt[333] : $txt[334]) . ' (' . $txt[330] . ': ' . $child['topics'] . ', ' . $txt[21] . ': ' . $child['posts']/*Board Viewers - by HarzeM*/ . (($child['viewers'] > 0 ) ?  ', ' . $child['viewers'] . (($child['viewers'] > 1) ? $txt['board_viewers'] : $txt['board_viewer']) : '' ) . ')">' . $child['name'] . '</a>';
                                                $children[] = $child['new'] ? '<b>' . $child['link'] . '</b>' : $child['link'];
                                        }
affiliate blog

bmhm

1.) I'm still waiting for a german translation - I can do it if you like!!!
2.) When will the next version be released where i can see WHO is viewing the boards, not only the number??? ^^

Harzem

1. welcome to your german translation :) Only the words "viewing" should be changed.
2. I'm working on the next version. But you can readily see who is vieweing, by entering the board and looking right above the message list. I will add a popup function to the board index soon.

kezayah

Quote from: nite0859 on April 01, 2006, 05:07:36 PM
Now I can see "1 Member and 0 Guests are viewing this board" .
I don't see this sentence !!!  :o :o :o

Harzem

This sentence is in boards, not on the main page.

bmhm

Yeah, I know the other way to see how is viewing..

Well about the translation... seemed as if I was talking about the other mod.

Hmm "viewing" can't be translated by it self.

User -> Benutzer
Member -> Mitglied

Instead of view I'd write "x users are viewing this board: <namelist>"
German: "x Benutzer betrachten dieses Board: <namensliste"
or saying active insteead of viewing you can write: "x Benutzer sind im Board aktiv: <namensliste>"

Don't forget to put it into x.german.php...

Hmm I'm looking forward to your popup, even if I won't use it :p Im more interested in the function mentioned above ;-)

So far...

Advertisement: