TP-Docs
HTML5 Icon HTML5 Icon HTML5 Icon
TP on Social Media

Recent

Welcome to TinyPortal. Please login or sign up.

Members
  • Total Members: 3,966
  • Latest: safir45
Stats
  • Total Posts: 195,990
  • Total Topics: 21,323
  • Online today: 1,579
  • Online ever: 8,223 (February 19, 2025, 04:35:35 AM)
Users Online
  • Users: 1
  • Guests: 425
  • Total: 426
  • @rjen

built in shoutbox question

Started by lakelady, March 12, 2007, 12:21:46 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

brianjw

Actually the shoutbox doesnt auto-refresh ;)
It actually refreshes the page when you are posting a shout. To see other shouts you have to refresh manually :)

Brianjw

IchBin

Back on topic. Was working on this with one of the SMF team members yesterday. I think i have it working, but I don't have the code here at work. I'll mark this topic to notify me of replies if someone wants to post a reply to this later tonight I should be able to get the code posted here when I get home from school.

IchBin

ok, take this code in the TPortal.php file: (Thank you sleepy from SMF)
if($limit>100) $limit=100;
$request = db_query("SELECT * FROM {$tp_prefix}shoutbox WHERE 1 ORDER BY value2 DESC LIMIT $limit", __FILE__, __LINE__);
if (mysql_num_rows($request) > 0)
{
$shouts= $txt['tp-last'].' '.$limit.' '.$txt['tp-shouts'].'<hr />';

while($row = mysql_fetch_assoc($request))
{
$shouts .='<div style="margin: 4px;"><div style="border: dotted 1px; padding: 2px 4px 2px 4px;" class="windowbg2"><b>'.$row['value3'].'</b></div><div style="padding: 2px;"> '.timeformat($row['value2']).'</div><div style="padding: 4px;">';
$myshout='';
$myshout=$row['value1'];
$shouts .= doUBBC($myshout);
$shouts .= '</div></div>';
}

// Now we reverse it!
$shouts = array_reverse($shouts);

$context['TPortal']['shoutbox']=$shouts;


mysql_free_result($request);
}


Replace with this:
if($limit>100) $limit=100;
$request = db_query("SELECT * FROM {$tp_prefix}shoutbox WHERE 1 ORDER BY value2 DESC LIMIT $limit", __FILE__, __LINE__);
if (mysql_num_rows($request) > 0)
{
$context['TPortal']['shoutbox'] = $txt['tp-last'].' '.$limit.' '.$txt['tp-shouts'].'<hr />';


// Clean stuff
$shouts = array();
$i = 0;


// Loop it into an array to reverse
while($row = mysql_fetch_assoc($request))
$shouts[$i++] = '<div style="margin: 4px;"><div style="border: dotted 1px; padding: 2px 4px 2px 4px;" class="windowbg2"><b>' . $row['value3'] . '</b></div><div style="padding: 2px;"> ' . timeformat($row['value2']) . '</div><div style="padding: 4px;">' . doUBBC($row['value1']) . '</div></div>';


// Freedom!!!
mysql_free_result($request);


// Now we reverse it!
$shouts = array_reverse($shouts);

// For each we divide and conquer.
foreach($shouts as $shout)
$context['TPortal']['shoutbox'] .= $shout;

}

Thurnok

I think what Brian is trying to point out to you is that the TP shoutbox is not intended as an instant messenger.  In otherwords, its not intended to be used as an interactive chat program.  It's for leaving a shout at the site during some point of your visit, not for constant interactive chat with members.

Perhaps what you are looking for is something similar to Flash Chat, or X7 Chat, or other IM type chat program for websites.
Thurnok
The one, the only!

birne

Dunno which of the threads in which this question was asked I should prefer to post an answer/suggestion, so I'll just do it in this one.

After searching for a possibilty to reverse just the marquee of the shoutbox, I figured out, what actually makes the shoutbox marquee from up (newest post) to down (oldest post). It's some kind of JavaScript. I viewed the sourcecode of the TP startpage in firefox and saved it as an .html file, trying to find out which part of the JS exactly does what (also I claim myself an experinced webbased-language codemonkey I just don't like JS ...). I came to the conclusion changing just five little "top"s to "bottom"s just working fine for what I was looking for. After loading the site, the shoutbox just marquees the other way roundÃ,´. Now the oldest post is shown first and slowly scrolls up to the latest one.
The only problem I now still have is to figure where in this huge load of code this JS comes from ... and to be honest, I don't have a single clue, maybe you know where it is, and where I therefore can edit it.

This is the code, after echoed into the browser, so copied from just the sourceviewer of firefox:

<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>

Changing just those five first "top" into "bottom" in "initializemarquee()" and "scrollmarquee()" ... but dunno where in the real code this part of JS is ...

Best regards birne

bloc

Try TPortal.php, towards the end of the file, but not last. Search for "Cross browser"

This website is proudly hosted on Crocweb Cloud Website Hosting.