xoops forums

Lupin

Just popping in
Posted on: 5/21 14:01
Lupin
Lupin (Show more)
Just popping in
Posts: 89
Since: 2007/6/1 2
#1

Change scrolling direction in Shoutbox

In the "stand alone" version of this module I can choose in wich direction I read messages.

In the Xoops module, I can only have last message first ... but it is just a little problematic if user must follow a discussion...
I found a way to change the shouts reading : (shoutframe.php line 79 )
if (!empty($shouts)) {     $xoopsTpl->assign('shouts'array_reverse($shouts)); }


Buy I should change the scrollbar starting from below ... How can I do?
Better try a different way?

TY

Pino

Mamba

Moderator
Posted on: 5/22 0:49
Mamba
Mamba (Show more)
Moderator
Posts: 10933
Since: 2004/4/23
#2

Re: Change scrolling direction in Shoutbox

I've added the scrolling as an option in Preferences.

Check it out at in Shoutbox 5.10 RC-1:

https://github.com/mambax7/shoutbox/releases/

In the future, you can do it this way:
in xoops_version.php add a new Preference:
$modversion['config'][] = [
    
'name'        => 'scroll_type',
    
'title'       => '_MI_SHOUTBOX_TITLE47',
    
'description' => '_MI_SHOUTBOX_DESC47',
    
'formtype'    => 'select',
    
'valuetype'   => 'int',
    
'options'     => ['_MI_SHOUTBOX_OP47_TL' => 0'_MI_SHOUTBOX_OP47_TA' => 1],
    
'default'     => 1,
];


In /language/english/modinfo.php add translations for the new preference:
define('_MI_SHOUTBOX_TITLE47''Scrolling direction');
define('_MI_SHOUTBOX_DESC47''Should the new message be added on top or at the bottom?');
define('_MI_SHOUTBOX_OP47_TL''Bottom');
define('_MI_SHOUTBOX_OP47_TA''Top');


in shoutframe.php check for the new preference:
$scrollDirection $helper->getConfig('scroll_type');
if (!empty(
$shouts)) {
    if (
=== $scrollDirection) {
        
$xoopsTpl->assign('shouts'array_reverse($shouts));
    } else {
        
$xoopsTpl->assign('shouts'$shouts);
    }
}


Of course, you would have to update the module to make it work.
Support XOOPS => DONATE
Use 2.5.10 | Docs | Modules | Bugs