is there a way to reverse how shouts appear in the shoutbox? I find that having the entry box on the bottom and the new shouts at the top rather annoying, not to mention backwards of how we read in real life. Is there a way to change this? Easily? :)
oh, and another question.....is it possible to have the shoutbox entry posted when a user hits return, instead of having to hit the shout button?
thanks
This question have been coverd a few times.
If you try and search for "shoutbox reverse" or "shoutbox order" it might come up.
Make sure you eather do the search from the advansed search page, or from the forum index page so the search works through all the forums and topics.
I had searched using a few different terms and hadn't found any answers before posting my question. Thank you for suggesting some different terms. I used them as well just now and still haven't found an answer.
are there known conflicts with other chat boxes that are available out there? Are there other shoutboxes that have proven to work well in TP that have this modification?
Strange you didnt find that with the first suggestion i made, perhaps you didnt search from the advansed search page ?
Anyway, here is the topic that will give you what you want.
http://www.tinyportal.net/index.php?topic=5481.0
I read that thread and it looks to me there are still problems with the code to get it to do what we're looking for. Perhaps I'm missing something here (highly possible since I'm new to this)
Last two posts in that thread....
Jr. Member
**
Offline Offline
Posts: 17
View Profile WWW Personal Message (Offline)
Re: Change the order of posts in Shoutbox?
Ã,« Reply #8 on: August 23, 2006, 06:41 Ã,»
Reply with quoteQuote
That's all well and good but if I make the change as above and I have it set to show just the last 8 shouts I end up with the Shouts the wrong way round. So although it now scrolls the correct way it shows the first 8 shouts not the last 8. Anyone have an idea how to change that round?
Report to moderator Logged
Tank
Sr. Member
****
Offline Offline
Posts: 355
Danish Dude
View Profile WWW Email Personal Message (Offline)
Re: Change the order of posts in Shoutbox?
Ã,« Reply #9 on: September 10, 2006, 03:43 Ã,»
Reply with quoteQuote
I could also use a solution for this.. Roll Eyes
There really shouldnt be a problem if the conversations are backwords because it's for shouting a message and not having conversations like a chat room ;)
I'm sorry, I don't understand the distinction. In my experience people use the terms shoutbox and chatbox interchangeably.
Looking at this I'm not sure how it can work. Still being a beginner coder myself I can't figure it out. The LIMIT retrieves the limit you set in the shoutbox settings. So when you change the ORDER BY to reverse the order your grabbing the earliest shouts instead of the latest shouts. I'll keep looking at it, but I'm unsure how it can work without sorting or ordering it by another column.
What I mean...
Shoutbox = you post one thing and say like hey and a little story or goodnight :)
Chat = you talk to people either with autorefreshing equipment or flashchat and history is not saved in this.
The differences are bigger than you think ;)
Quote from: Brianjw on March 13, 2007, 01:58:06 AM
What I mean...
Shoutbox = you post one thing and say like hey and a little story or goodnight :)
Chat = you talk to people either with autorefreshing equipment or flashchat and history is not saved in this.
The differences are bigger than you think ;)
well, the built-in shoutbox in TP auto-refreshes and there is a history kept (at least the admin has access to it). soooooo....like I said, in my experience they are used interchangeably
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
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.
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;
}
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 (http://www.tufat.com/script2.htm), or X7 Chat (http://www.x7chat.com/), or other IM type chat program for websites.
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
Try TPortal.php, towards the end of the file, but not last. Search for "Cross browser"