News:

Bored?  Looking to kill some time?  Want to chat with other SMF users?  Join us in IRC chat or Discord

Main Menu

nneonneo's Shoutbox

Started by nneonneo, December 26, 2006, 06:58:11 PM

Previous topic - Next topic

hotrod007

Sounds simple.  Right after this right?  template_main_below;

nneonneo

Right after this:
function template_main_below()
{
global $context, $settings, $options, $scripturl, $txt;

add
// YSHOUT HERE
echo '
<br /><b>Shout Box</b><br /><br />
<div id="yshout">',$txt['yshout_loading'],'<br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /></div>';
// YSHOUT END


Assuming you've added the other code block (CSS+JS), the shoutbox should now function right under the Google ads.
Check out the AJAX Shoutbox (my one and only mod to date :P)
Do you like SMF? Are you using ProBoards, InvisionFree, ActiveBoards or some other web-hosted forum? I can help you convert to SMF (without having to purchase a DB conversion)...contact me [nneonneo {at} gmail *dot* com], and see this topic
spammers here!

hotrod007

#962
it's there now..  I added the code under internet explore....  and the postion code..  I see it  but I have this error showing on top of it

Fatal error: Call to undefined function: session_commit() in /vservers/hotrod007/htdocs/forums/yshout/yshout.php on line 651

You can see the error here.

www.njsaltwaterfisherman.com/forums

guest is at false, seems like it just hangs loading for guests..

nneonneo

Change session_commit to session_write_close in yshout/yshout.php.
Check out the AJAX Shoutbox (my one and only mod to date :P)
Do you like SMF? Are you using ProBoards, InvisionFree, ActiveBoards or some other web-hosted forum? I can help you convert to SMF (without having to purchase a DB conversion)...contact me [nneonneo {at} gmail *dot* com], and see this topic
spammers here!

pongsak

Quote from: nneonneo on August 28, 2007, 08:21:35 PM
@pongsak: Try clearing out all the existing shouts (/clear), then try again. It should work better. As to why it opens a new window, I don't know; what browser are you using? Finally, to fix the other problem, I thought you wanted to use SMF's quoting. If that's not necessary, then you can simply change the [ quote ] ... part in the code to something else.
I use FF, and IE also open a new page too.
The word "quote" is in same line now, but the new page open when click quote still.

PS. I guess may be u 'll forget "writelog" 8-)
smf 1.1.2 with dilbermc themes.
> 50 mods installed.

hotrod007

Quote from: nneonneo on August 28, 2007, 11:47:13 PM
Change session_commit to session_write_close in yshout/yshout.php.

Bingo!.  All Good.  Thanks For all the help..

Hotrod

nneonneo

@pongsak: Strange that it should open a new window. It worked for me in Safari and FF, though I did not test IE. Maybe something else on te page affects it. What is your forum URL?

@hotrod007: Good to hear :)
Check out the AJAX Shoutbox (my one and only mod to date :P)
Do you like SMF? Are you using ProBoards, InvisionFree, ActiveBoards or some other web-hosted forum? I can help you convert to SMF (without having to purchase a DB conversion)...contact me [nneonneo {at} gmail *dot* com], and see this topic
spammers here!

vno

nneonneo,

I changed to what you recently advised:
return '<center>'.substr(timeformat(intval($matches[1]), true), 1, -1).'</center><br />';

And the result looks like this:

[
b>Today at 10:00:42 A
]
Vno: bla bla bla


... so it's still resulting with the "[]" ..... and I have no clue how the "b>" before the date and "A" after the time got there. :D

Thanks

nneonneo

D'Oh! Sorry, I told you the wrong instructions.

Revert the last change (i.e. remove the substr(...,1, -1)) (so it looks like
return '<center>'.timeformat(intval($matches[1]), true).'</center><br />';
again) and do the following change:

Find
$chatText=preg_replace_callback("/<timeval=(\d+)>/","preg_timeformat",$chatText);
replace with
$chatText=preg_replace_callback("/\[<timeval=(\d+)>\]/","preg_timeformat",$chatText);
and it should work
Check out the AJAX Shoutbox (my one and only mod to date :P)
Do you like SMF? Are you using ProBoards, InvisionFree, ActiveBoards or some other web-hosted forum? I can help you convert to SMF (without having to purchase a DB conversion)...contact me [nneonneo {at} gmail *dot* com], and see this topic
spammers here!

pongsak

Quote from: nneonneo on August 29, 2007, 11:14:20 AM
@pongsak: Strange that it should open a new window. It worked for me in Safari and FF, though I did not test IE. Maybe something else on te page affects it. What is your forum URL?
http://www.simplemachines.org/community/index.php?topic=137508.msg1208692#msg1208692
smf 1.1.2 with dilbermc themes.
> 50 mods installed.

vno

That works PERFECT!

Thanks nneonneo! :)

pongsak

One another question  :D.
Some member request me to config yshout line specific for any person, then i'd added yshout_line column in smf_members and then read it in yshout.php with loadMemberData(id).

Suppose A = 15 lines; B = 10 lines, after /clear function.
if no one use yshout but A , A's 15 lines, and if  only B use, B's 10 lines.
But if A and B use together, A's 15 lines and B's 15 lines too, Why? (i test in same computer but use A in FF and B in IE )
smf 1.1.2 with dilbermc themes.
> 50 mods installed.

nneonneo

@pongsak: Reason why this happens is because it is reading the home.txt file in all cases, which contains a certain number of lines. If you want to avoid this behaviour, you can opt to set max_lines to a "global" maximum (e.g. 100), then use the tail library (included) to just get the last n lines according to preference.
Instead of
$chatText = file_get_contents($chatPath); in readChat, you would use {
require_once("class.tail.php");
$mytail = new tail($chatPath);
$mytail->setGrep(".*");
$mytail->setNumberOfLines(<NUMBER OF LINES>);
$chatText=$mytail->output(PLAIN);
}

where, of course, <NUMBER OF LINES> is how many lines should be shown.

@vno: Good to hear :)
Check out the AJAX Shoutbox (my one and only mod to date :P)
Do you like SMF? Are you using ProBoards, InvisionFree, ActiveBoards or some other web-hosted forum? I can help you convert to SMF (without having to purchase a DB conversion)...contact me [nneonneo {at} gmail *dot* com], and see this topic
spammers here!

nneonneo

@pongsak (update): Yes, adding ";void(0)" to the end of the href in the quote should prevent it from opening a new window. I had forgotten that it returned a value.
The end of the line should look like
'[/quote]\';void(0);"><span class="adminlink">quote</span></a>';
To make it not use the SMF quoting style, you can make the line look like this:
$writeText.='<a href="javascript:$(\'shout-text\').value += \'\\x22'.$origText.'\\x22 \';void(0);"><span class="adminlink">quote</span></a>';
which will make the quote look like
nneonneo: arghblargh
otheruser: "arghblargh" seriously?

You can edit it however you like, but please make sure that single quotes are encoded as \\x27 and double quotes as \\x22 because otherwise they will be misinterpreted by either the HTML or the Javascript.
Check out the AJAX Shoutbox (my one and only mod to date :P)
Do you like SMF? Are you using ProBoards, InvisionFree, ActiveBoards or some other web-hosted forum? I can help you convert to SMF (without having to purchase a DB conversion)...contact me [nneonneo {at} gmail *dot* com], and see this topic
spammers here!

pongsak

#974
Thanks a lot, the quote it works well now.

For line numbers,
Quoteset max_lines to a "global" maximum (e.g. 100)
I didn't set it to fixed number cause i intend to give it flexible to member need.
This the code i used.


loadTheme();

// Set the maximum amount of lines to be displayed at a time
global $user_profile,  $user;
loadMemberData(array($user['id']));
if (!empty($user_profile[$user['id']]['yshout_line']))
$max_lines = $user_profile[$user['id']]['yshout_line'];
else
$max_lines = 10;

$max_lines+=1;


after i chage the code to

if (file_exists($chatPath))
   {
      require_once("class.tail.php");
      $mytail = new tail($chatPath);
      $mytail->setGrep(".*");
      $mytail->setNumberOfLines($max_lines);
      $chatText=$mytail->output(PLAIN);
   }

All the previous messages 'd disappear.
There's nothing appear in shoutbox after sending message.

PS: i use $max_lines cause i've set line settings individually (that read from database).
smf 1.1.2 with dilbermc themes.
> 50 mods installed.

nneonneo

See, the reason why I told you to set $max_lines to a global maximum is because it controls the truncate option. The main shout file is truncated once it reaches a set number of lines -- $max_lines -- and, as it currently stands, this truncation limit varies from person to person. Setting max_lines to a reasonable maximum (to ensure tail doesn't take too long to run, but provide a high enough ceiling that any user will be satisfied) will ensure that the chat file always has enough lines to show anyone.

Using a different variable (e.g. $display_lines) and adding it to the globals list in readChat should fix this problem.

Change
function readChat($chatFile, $logDir) {
global $user;

to
function readChat($chatFile, $logDir) {
global $user, $display_lines;

and
$mytail->setNumberOfLines($max_lines);
to
$mytail->setNumberOfLines($display_lines);
(incidentally, the reason why the shoutbox is blank is because max_lines is not on the globals list).

Then, your own code looks like
loadTheme();

// Set the maximum amount of lines to be displayed at a time
global $user_profile,  $user;
loadMemberData(array($user['id']));
if (!empty($user_profile[$user['id']]['yshout_line']))
$display_lines = $user_profile[$user['id']]['yshout_line'];
else
$display_lines = 10;

This should ensure that the line settings for all users are respected, that the history view is functional and that the chat file has enough entries (lines) to show for all users.

That probably wasn't the most clear explanation I could give; if you need clarification just ask.
Check out the AJAX Shoutbox (my one and only mod to date :P)
Do you like SMF? Are you using ProBoards, InvisionFree, ActiveBoards or some other web-hosted forum? I can help you convert to SMF (without having to purchase a DB conversion)...contact me [nneonneo {at} gmail *dot* com], and see this topic
spammers here!

porcelainprincess

I have looked in the thread, sorry if I missed it, LONG thread.

I love this mod though I have a problem, I use TP along with a created theme, and when people try to upshrink the header, it closed the shout box and won't open. It's in a center block and it may have been another mod, I am not sure but I can't find the problem at all.

Here is a screen shot. Thanks for the help, I am out of ideas!


nneonneo

What do you mean by "broken"?
Did you insert the "upshrink" code (JS block which looks like // YSHOUT HERE
document.getElementById("yshout").style.display = mode ? "none" : "";
if(!mode)
{
loadChat();
}
// YSHOUT END
) into the theme? This code causes problems for forums which either don't use the usual location (pongsak, this applies to you too because you did not put the shoutbox in the usual header location) or which use custom themes.
If you did use this code, remove it from index.template.php, and remove ', empty($options['collapse_header']) ? '>' : ' style="display: none;" as well.

If this isn't the case, let me have a look at your forum.
Check out the AJAX Shoutbox (my one and only mod to date :P)
Do you like SMF? Are you using ProBoards, InvisionFree, ActiveBoards or some other web-hosted forum? I can help you convert to SMF (without having to purchase a DB conversion)...contact me [nneonneo {at} gmail *dot* com], and see this topic
spammers here!

pongsak

Great, work like a charm.
smf 1.1.2 with dilbermc themes.
> 50 mods installed.

porcelainprincess

Quote from: nneonneo on August 29, 2007, 10:46:11 PM
What do you mean by "broken"?

It went up but won't go back down. The button is there but it just won't come back down.

I don't actually have that stuff in there, I added :

// YSHOUT HERE
global $boardurl;
echo '
<script src="http://justue.com/yshout/js/prototype.js" type="text/javascript"></script>
<script src="http://justue.com/yshout/js/moo.ajax.js" type="text/javascript"></script>
<script src="http://justue.com/yshout/js/behaviour.js" type="text/javascript"></script>
<script src="http://justue.com/yshout/js/domFunction.js" type="text/javascript"></script>
<script type="text/javascript">

var myfunc = new domFunction(function()
{
',empty($options['collapse_header']) ? 'loadChat();':'','
}, { "yshout":"id"});
var board_url = "', $boardurl, '";

</script>
<script src="http://justue.com/yshout/js/yshout.js?Mar42007" type="text/javascript"></script>
<script type="text/javascript">var shoutFile = "home.txt";</script>
<style type="text/css">
#yshout {
font-size: 10px;
}
#yshout p {
margin: 0 0 0; /* Top Bottom Linespacing */
}
.shout-invalid {
background: #FFFDD1;
}
#yshout fieldset {
border: none;
}
#yshout em {
font-style: normal;
}
#yshout p {
line-height: 1;
margin-top: 0;
}
#yshout {
overflow: hidden;
}
#yshout .shout-timestamp {
font-weight: normal;
color: #CCCCCC;
}
#forum-name, #shout-text, #shout-button {
font-size: 9px;
margin: 0;
padding: 0;
                        color: #B7C3D0;
}
#yshout #forum-name {
color: #50729F;
width: 70px;
margin-right: 5px;
}
#yshout #shout-text {
                        color: #9AC0CD;
width: 310px;
margin-right: 5px;
}
#yshout #shout-button {
width: 55px;
                        color: #FFFFFF;
}
#shouts .owner a {
color: #50A6C2;
}
#shouts .moderator a {
color: #00F;
}
</style>';
// YSHOUT END


Besides what I have posted in the phpbox. Thank you for your help, let me PM you a url.

Advertisement: