TinyPortal

Development => Feedback => Topic started by: insanemustang on April 30, 2008, 04:24:40 PM

Title: Users Online Today Mod
Post by: insanemustang on April 30, 2008, 04:24:40 PM
I have tried everything in an attempt to create a block to show who has been online today, and I can't figure it out.

It appears that the block snipplet board, where I began this effort, is not a board for support for the block error I am getting.  That board says if you need help, but it in requests, so that's what I am doing.

If anyone could help me I'd really appreciate it.

SMF 1.1.4
TP 0.9.8

What I have done so far:

I did what was directed by this post  (http://www.tinyportal.net/index.php?topic=2365.msg78105#msg78105). 

But in my block I have this error:
QuoteFatal error: Cannot redeclare ssi_shutdown() (previously declared in /home/mustang/public_html/bn/SSI.php:187) in /home/mustang/public_html/bn/SSI.php on line 189

Thanks in advance for any help
Title: Re: Users Online Today Mod
Post by: insanemustang on April 30, 2008, 04:44:39 PM
delete this please
Title: Re: Users Online Today Mod
Post by: IchBin on April 30, 2008, 05:09:36 PM
So what was the answer? :)
Title: Re: Users Online Today Mod
Post by: insanemustang on April 30, 2008, 05:13:30 PM
I don't have one.  But I do know it just miraculously appeared.  I haven't touched it since it's working.

I think I applied a Users Online Today Mod that I don't know where I got, and I'm pretty sure it is just another way to do what I want.

Then I found the code it inserted into my Stats block, found the ssi code and then added the ssi into a php block.

Title: Re: Users Online Today Mod
Post by: insanemustang on May 06, 2008, 07:46:41 PM
I wish I could make it scroll though.... getting long
Title: Re: Users Online Today Mod
Post by: JPDeni on May 06, 2008, 07:54:33 PM
There are a number of scrolling scripts at http://dynamicdrive.com/dynamicindex2/index.html
Title: Re: Users Online Today Mod
Post by: insanemustang on May 06, 2008, 08:25:36 PM
Quote from: JPDeni on May 06, 2008, 07:54:33 PM
There are a number of scrolling scripts at http://dynamicdrive.com/dynamicindex2/index.html

But this will have to go in the blocks.template.php folder correct?  does it need to be special code, or written in php? 

I'm going to mess it up, I know I will lol
Title: Re: Users Online Today Mod
Post by: IchBin on May 06, 2008, 08:29:09 PM
Thats why you make a backup. :) Then its as easy as just replacing the file with the original if you screw it up.
Title: Re: Users Online Today Mod
Post by: JPDeni on May 06, 2008, 08:33:42 PM
QuoteBut this will have to go in the blocks.template.php folder correct?
I'm pretty sure you can put it into the block code. I did a scrolling thing for someone a month or so ago. I'll go look for it.

ETA:

I found it. http://www.tinyportal.net/index.php?topic=22723.msg184320#msg184320
Title: Re: Users Online Today Mod
Post by: Ianedres on May 06, 2008, 08:35:08 PM
Quote from: IchBinâ,,¢ on May 06, 2008, 08:29:09 PM
Thats why you make a backup. :) Then its as easy as just replacing the file with the original if you screw it up.

True dat!  :coolsmiley:

The other thing I find so helpful is have the direct link to your block management in the admin panel bookmarked- so you can disable a buggy block if need be.  8)
Title: Re: Users Online Today Mod
Post by: JPDeni on May 06, 2008, 08:36:40 PM
Oh, you already posted a response and may have missed my link.

http://www.tinyportal.net/index.php?topic=22723.msg184320#msg184320

This is a scrolling block that has recent posts in it. You should be able to alter it for members.
Title: Re: Users Online Today Mod
Post by: IchBin on May 06, 2008, 08:57:59 PM
Quote from: Ianedres on May 06, 2008, 08:35:08 PM
Quote from: IchBin™ on May 06, 2008, 08:29:09 PM
Thats why you make a backup. :) Then its as easy as just replacing the file with the original if you screw it up.

The other thing I find so helpful is have the direct link to your block management in the admin panel bookmarked- so you can disable a buggy block if need be.  8)

There's a few things you can do in that case. Often, you can hit the back button in your browser if you keep that window open. :) And of course, you can add ;noblocks to your URL to disable all blocks as admin.
True dat!  :coolsmiley:
Title: Re: Users Online Today Mod
Post by: insanemustang on May 06, 2008, 09:34:18 PM
QuoteYou should be able to alter it for members.

That was funny lol
Title: Re: Users Online Today Mod
Post by: insanemustang on May 07, 2008, 01:42:06 PM
Anyone got the "bubba way" for me to do this?
Title: Re: Users Online Today Mod
Post by: JPDeni on May 07, 2008, 02:03:19 PM
I'm sorry. I misunderstood your level of expertise. :)

Can you post the code you're using now? The original post that you linked to added the users online today in the statsbox, which is different than what your graphic shows.
Title: Re: Users Online Today Mod
Post by: insanemustang on May 07, 2008, 02:31:29 PM
I think this it - thank you for helping me.

   // add online users
            echo '<hr /><img src="'.$settings['images_url'].'/icons/online.gif" style="margin: 0;" align="bottom" alt="" />
                 <a href="'.$scripturl.'?action=who"><b>'.$txt[158].'</b></a><br />';

            $online = ssi_whosOnline('array');
   echo $bullet.$txt['tp-users'].': '.$online['num_users'];
   echo '<br />'.$bullet.$txt['tp-guests'].': '.$online['guests'];
   echo '<br />'.$bullet.$txt['tp-total'].': '.$online['total_users'].'<hr />
<div style="width: 100%; ' , $online['num_users']>14 ? 'height: 23ex;overflow: auto;' : '' ,'">';

      foreach($online['users'] as $user){
echo $bullet2 , $user['hidden'] ? '<i>' . $user['link'] . '</i>' : $user['link'];
echo '<br />';
   }
echo '</div>';
         }
echo '</div>';
Title: Re: Users Online Today Mod
Post by: JPDeni on May 07, 2008, 03:23:13 PM
Well I won't be able to give you the full code for the block without the current full code from the block. :) But maybe I can give you what you need to work it out yourself.

At the beginning of your block, before anything else, add


echo '
<style type="text/css">

#marqueecontainer{
position: relative;
width: 95%; /*marquee width */
height: 150px; /*marquee height */
overflow: hidden;
padding: 2px;
padding-left: 4px;
}

</style>

<script language="javascript" type="text/javascript">

/***********************************************
* Cross browser Marquee II- © Dynamic Drive (www.dynamicdrive.com)
* This notice MUST stay intact for legal use
* Visit http://www.dynamicdrive.com/ for this script and 100s more.
***********************************************/

var delayb4scroll=1000 //Specify initial delay before marquee starts to scroll on page (2000=2 seconds)
var marqueespeed=1
var pauseit=1 //Pause marquee onMousever (0=no. 1=yes)?

////NO NEED TO EDIT BELOW THIS LINE////////////

var copyspeed=marqueespeed
var pausespeed=(pauseit==0)? copyspeed: 0
var actualheight=\'\'

function scrollmarquee(){
if (parseInt(cross_marquee.style.top)>(actualheight*(-1)+8))
cross_marquee.style.top=parseInt(cross_marquee.style.top)-copyspeed+"px"
else
cross_marquee.style.top=parseInt(marqueeheight)+8+"px"
}

function initializemarquee(){
cross_marquee=document.getElementById("vmarquee")
if(cross_marquee == null)
   return
cross_marquee.style.top=0
marqueeheight=document.getElementById("marqueecontainer").offsetHeight
actualheight=cross_marquee.offsetHeight
if (window.opera || navigator.userAgent.indexOf("Netscape/7")!=-1){ //if Opera or Netscape 7x, add scrollbars to scroll and exit
cross_marquee.style.height=marqueeheight+"px"
cross_marquee.style.overflow="scroll"
return
}
setTimeout(\'lefttime=setInterval("scrollmarquee()",30)\', delayb4scroll)
}

if (window.addEventListener)
window.addEventListener("load", initializemarquee, false)
else if (window.attachEvent)
window.attachEvent("onload", initializemarquee)
else if (document.getElementById)
window.onload=initializemarquee


</script>

<div id="marqueecontainer" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">
<div id="vmarquee" style="position: absolute; width: 98%;">';


At the end of your code -- the very bottom of the block -- add


echo '
</div>
</div>
   ';


I know this works for scrolling recent topics. It should work for your users online today.
Title: Re: Users Online Today Mod
Post by: insanemustang on May 07, 2008, 03:29:53 PM
I'm sorry.  The code I gave you was from the TPortalBlocks.template.php

My code for the block is:
echo '<img src="'.$settings['actual_images_url'].'/icons/online.gif'.'"  /> <a href="'.$scripturl.'?action=who"><b>'.$txt[158].'</b></a>';
ssi_whosOnline_today();


I'm sorry, I should have been more specific.  How does this change what you posted?
Title: Re: Users Online Today Mod
Post by: JPDeni on May 07, 2008, 03:55:16 PM
It probably doesn't. :) It's just that I was going to post the whole thing to make it easier for those who come along in the future. Also, it makes it easier for me to test it out.


echo '
<style type="text/css">

#marqueecontainer{
position: relative;
width: 95%; /*marquee width */
height: 150px; /*marquee height */
overflow: hidden;
padding: 2px;
padding-left: 4px;
}

</style>

<script language="javascript" type="text/javascript">

/***********************************************
* Cross browser Marquee II- © Dynamic Drive (www.dynamicdrive.com)
* This notice MUST stay intact for legal use
* Visit http://www.dynamicdrive.com/ for this script and 100s more.
***********************************************/

var delayb4scroll=1000 //Specify initial delay before marquee starts to scroll on page (2000=2 seconds)
var marqueespeed=1
var pauseit=1 //Pause marquee onMousever (0=no. 1=yes)?

////NO NEED TO EDIT BELOW THIS LINE////////////

var copyspeed=marqueespeed
var pausespeed=(pauseit==0)? copyspeed: 0
var actualheight=\'\'

function scrollmarquee(){
if (parseInt(cross_marquee.style.top)>(actualheight*(-1)+8))
cross_marquee.style.top=parseInt(cross_marquee.style.top)-copyspeed+"px"
else
cross_marquee.style.top=parseInt(marqueeheight)+8+"px"
}

function initializemarquee(){
cross_marquee=document.getElementById("vmarquee")
if(cross_marquee == null)
   return
cross_marquee.style.top=0
marqueeheight=document.getElementById("marqueecontainer").offsetHeight
actualheight=cross_marquee.offsetHeight
if (window.opera || navigator.userAgent.indexOf("Netscape/7")!=-1){ //if Opera or Netscape 7x, add scrollbars to scroll and exit
cross_marquee.style.height=marqueeheight+"px"
cross_marquee.style.overflow="scroll"
return
}
setTimeout(\'lefttime=setInterval("scrollmarquee()",30)\', delayb4scroll)
}

if (window.addEventListener)
window.addEventListener("load", initializemarquee, false)
else if (window.attachEvent)
window.attachEvent("onload", initializemarquee)
else if (document.getElementById)
window.onload=initializemarquee


</script>

<div id="marqueecontainer" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">
<div id="vmarquee" style="position: absolute; width: 98%;">';

echo '<img src="'.$settings['actual_images_url'].'/icons/online.gif'.'"  /> <a href="'.$scripturl.'?action=who"><b>'.$txt[158].'</b></a>';
ssi_whosOnline_today();

echo '
</div>
</div>
   ';
Title: Re: Users Online Today Mod
Post by: insanemustang on May 07, 2008, 04:41:46 PM
Ok, I tried copying that and putting it in place of what I had on the tpportalblocks.template.php and I got a ton of errors

Can you help me out with where that goes, what it replaces, etc...

Thank you for your help
Title: Re: Users Online Today Mod
Post by: insanemustang on May 07, 2008, 04:43:38 PM
Nevermind, I put that in my block and now it's scrolling the whole block lol

I wanted the users online today to have a scroll bar so that specific area could be scrolled.....
Title: Re: Users Online Today Mod
Post by: insanemustang on May 07, 2008, 04:44:35 PM
but that is pretty cool..... I may leave it
Title: Re: Users Online Today Mod
Post by: JPDeni on May 07, 2008, 04:55:54 PM
No!!!! It goes into a block. You have a block with the title "Users On". I see it on your site and I see it scrolling. That isn't in a php block? If it isn't, put it in one.
Title: Re: Users Online Today Mod
Post by: insanemustang on May 07, 2008, 05:09:08 PM
Right, I got it now.

Thank you for your help, I really do appreciate it.
Title: Re: Users Online Today Mod
Post by: JPDeni on May 07, 2008, 05:33:56 PM
:) Cool. Glad to help.