Welcome to Geeklog, Anonymous Sunday, December 22 2024 @ 09:02 pm EST

Geeklog Forums

Using a Nuke plugin with Geeklog


Status: offline

Jay

Forum User
Junior
Registered: 02/14/07
Posts: 16
Location:Beverly, MA
I was on the hunt for a decent auto scrolling shoutbox. I checked out Chatterbox for geeklog, but it just wasnt what I was looking for. Being someone who experimented with Nuke before trying out geeklog, I knew of Shout Box for nuke. I have pretty much no experience with php development, but I was wondering if anyone has made an effort (and how hard it would be) to make this nuke shoutbox work with geeklog.

Shout Box v8.5.2

See it in action here
http://www.website-portals.net/index.php (left side)

If anyone knows of a near identical shoutbox for geeklog that already exists, I'd love to hear about it. Otherwise, is anyone willing to point me in the right direction towards getting this to work on my geeklog site?

Thanks,
Jay


I leave carnage in my wake.
 Quote

Status: offline

Jay

Forum User
Junior
Registered: 02/14/07
Posts: 16
Location:Beverly, MA
Nevermind, I BS'ed my own out of a simple php shoutbox, an iframe, and a little dynamic html inside a block. Looks pretty good, functions just about how I was looking for.

-Jay
I leave carnage in my wake.
 Quote

Sam

Anonymous
care share how you did it? I would like to implement the same on my site :pray:

thanx
 Quote

Status: offline

jmucchiello

Forum User
Full Member
Registered: 08/29/05
Posts: 985
Why are you looking to use a nuke plugin when there's a shoutbox right on the geeklog.net homepage? (Look down the lower right hand side.) It's a simple phpblock. Here's a forum post about it: here
 Quote

Status: offline

1000ideen

Forum User
Full Member
Registered: 08/04/03
Posts: 1298
What is that "dynamic HTML"? I try to find such a scrolling news block like here top left corner:
http://www.lemodesittjr.com/blogs/blog/index.html
 Quote

Status: offline

Jay

Forum User
Junior
Registered: 02/14/07
Posts: 16
Location:Beverly, MA
Quote by: jmucchiello

Why are you looking to use a nuke plugin when there's a shoutbox right on the geeklog.net homepage? (Look down the lower right hand side.) It's a simple phpblock. Here's a forum post about it: here



I wanted my shoutbox to scroll automatically, just like the one on the site I provided. The one I worked with is far from being integrated into geeklog, but it works for what I need.

First thing I did was grab phpshout v3. It's a typical shoutbox, with smiley support. It posts the data into a scrollable iframe, not automatic scrolling. So now my task was to make it automatically scrolling. This uses flat files, not SQL, so there is a downside, but it's alright. I might try to get another one to work, more geeklog friendly.

I configured the phpshout to where I wanted.

Now, to get it to scroll, I took the code from "automatic scrolling iframe" from dynamicdrive.com found here Iframe Scroller

With the script code provided on that site, I put it into my shoutbox block.

Text Formatted Code
<script type="text/javascript">

//specify path to your external page:
var iframesrc="path/to/shoutbox/index.php"

//You may change most attributes of iframe tag below, such as width and height:
document.write('<iframe id="datamain" src="'+iframesrc+'" width="100%" height="250px" marginwidth="0" marginheight="0" hspace="0" vspace="0" frameborder="0" scrolling="no"></iframe>')

</script>


Now I needed to modify the shoutbox files to do what I wanted. I did a few things. One, I got rid of the smileys, because they took up a lot of unneeded space. Maybe I'll bring them back later on a expanding menu or something. I also wanted to take the input forms off of the scrolling page, and have them fixed at the bottom of the block, so just the messages scroll. Here is everything I modified.

First, I had to take the scrolling code from the "external.htm" iframe provided by dynamic drive and apply it to my inc_forum.php file (the iframe for the phpshout)
This is my new inc_form.php
Text Formatted Code
<?
ob_start();
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>Shout Box</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">

<script language="JavaScript">
function addsmiley(symbol) {
  document.postshout.msg.value += symbol;
  document.postshout.msg.focus();
}

<!-- Begin
function popUp(URL) {
day = new Date();
id = day.getTime();
eval("page" + id + " = window.open(URL, '" + id + "', 'toolbar=0,scrollbars=1,location=0,statusbar=0,menubar=0,resizable=1,width=300,height=500');");
}
</script>
<link href="default.css" rel="stylesheet" type="text/css">
</head>
<body class="phpshout_body">
<div id="datacontainer" style="position:absolute;left:1px;top:10px;width:100%" onMouseover="scrollspeed=0" onMouseout="scrollspeed=cache">
  <table align="center" class="phpshout_table">
    <tr>
      <td class="phpshout_form"><?
        include "config.php";
        include "functions.php";
        banned_user();
       
        if (isset($_POST["Submit"])) {
               
                // Remove any tabs
                $_POST["name"] = str_replace("\t"," ",$_POST["name"]);
                $_POST["msg"] = str_replace("\t"," ",$_POST["msg"]);

                // Make name and string lower case for bad language filter
                $_POST["name"] = strtolower(stripslashes(trim(htmlspecialchars($_POST["name"]))));
                $_POST["msg"] = strtolower(stripslashes(trim(htmlspecialchars($_POST["msg"]))));

                if (!file_exists("messages.txt")) {
               
                        echo "<p class=\"error\">Messages.txt doesn't exsist. Please create a file call messages.txt on your server</p>";
               
                } else if ($_POST["name"] == "name" || $_POST["msg"] == "message" || $_POST["name"] == NULL || $_POST["msg"] == NULL) {
       
                        echo "<p class=\"error\">Name & message are required fields. Please enter your name and message.</p>";
       
                } else {
               
                        $filename = "messages.txt";
                        $handle = fopen($filename,"r");
                        $read = file_get_contents($filename);
               
                        if ($read != "" || $read != NULL) {
                                       
                                        $array = explode("\n", $read);

                                        if ($array[0] != NULL || $array[0] != "") {
                               
                                        list($name, $msg, $time, $ip) = explode("\t", $array[0]);
                                                                               
                                        $ip = trim($ip);
                                       
                                        // Convert timestamp to unix timestamp and get current unix timestamp
                                        $strtime = strtotime($time);
                                        $flood_gate_time = $strtime+$floodtime;
                                        $curtime = time();
                                        $valid = true;
                                        }
                                       
                                        if ($ip == $_SERVER['REMOTE_ADDR'] && $flood_gate_time > $curtime) {
                                                echo "<p class=\"error\">You must wait ".$floodtime." seconds before posting again</p>";
                                        } else {

                                        writetofile($_POST["name"],$_POST["msg"]);
                                       
                                        }
                                       
                        } else {
                                writetofile($_POST["name"],$_POST["msg"]);
                        }
                       
                } // end if file exists
               
        } // end submit

?></td>
    <tr>
      <td class="phpshout_form"><a class="phpshout_link" href="javascript:popUp('oldmsg.php')">Archive</a><br />      <br></td>
    </tr>
                <?
       
        $filename = "messages.txt";

        if (file_exists($filename)) {
       
        $handle = fopen($filename, "r");
        $read = file_get_contents($filename);
        $array = explode("\n", $read);
        $x=0;
       
        for($i=0; $i<$numofposts; $i++) {
               
                if ($array[$i] != NULL || $array[$i] != "") {
                       
                        list($name, $msg, $date, $ip) = explode("\t", $array[$i]);
                                       
                        $date = str_replace(" ","/",$date);
                        list($year,$month,$day,$time) = explode("/", $date);
                       
                        // convert text to smilies.
                        $msg = smiles($msg);

                        // Show date, Yes or No.
                        if ($showdate == "1") {
                                $title = "title=\"Posted ".$day."/".$month."/".$year." ".$time."\"";
                        } else {
                                $title = "";
                        }
                       
                                $x++;
                                if ( $x % 2 != 0 ) {
                                        echo "<tr><td ".$title." class=\"phpshout_posts\"><strong>".wordwrap($name,18,"<br>\n",1)." : </strong>".ereg_replace("([^ \/]{22})","\\1<wbr>",$msg)."</td></tr>";
                                } else {
                                        echo "<tr><td ".$title." class=\"phpshout_2nd_posts\"><strong>".wordwrap($name,18,"<br>\n",1)." : </strong>".ereg_replace("([^ \/]{22})","\\1<wbr>",$msg)."</td></tr>";
                                }      
                                               
                } else {
               
                break;
               
                }
        }
       
        fclose($handle);
       
        }
       
?>
  </table>
</div>
<script type="text/javascript">

//Specify speed of scroll. Larger=faster (ie: 5)
var scrollspeed=cache=1

//Specify intial delay before scroller starts scrolling (in miliseconds):
var initialdelay=500

function initializeScroller(){
dataobj=document.all? document.all.datacontainer : document.getElementById("datacontainer")
dataobj.style.top="5px"
setTimeout("getdataheight()", initialdelay)
}

function getdataheight(){
thelength=dataobj.offsetHeight
if (thelength==0)
setTimeout("getdataheight()",10)
else
scrollDiv()
}

function scrollDiv(){
dataobj.style.top=parseInt(dataobj.style.top)-scrollspeed+"px"
if (parseInt(dataobj.style.top)<thelength*(-1))
dataobj.style.top="5px"
setTimeout("scrollDiv()",40)
}

if (window.addEventListener)
window.addEventListener("load", initializeScroller, false)
else if (window.attachEvent)
window.attachEvent("onload", initializeScroller)
else
window.onload=initializeScroller

</script>

</body>
</html>
<?
ob_end_flush();
?>


This is the new index, so I could have my input fields outside of the scrolling area, fixed at the bottom.
Text Formatted Code
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>phpSHOUT Version 3 Created By Designanet.co.uk</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<?
        include "config.php";
        include "functions.php";
        banned_user();
?>
<link href="default.css" rel="stylesheet" type="text/css">
</head>

<body>
<IFRAME SRC="inc_form.php" WIDTH=200 HEIGHT=190 frameborder="0" name="shout" scrolling="yes" style="overflow-x: hidden;"></IFRAME><br /><form name="postshout" method="post" target="shout" action="inc_form.php">
<input class="textfields" name="name" type="text" id="name" value="<? echo fillnamevalues("name","name") ?>"><br /><input class="textfields" name="msg" type="text" id="msg" value="<? echo filltextvalues("msg","message") ?>" maxlength="<? echo $maxchars; ?>"><br /><input class="buttons" type="submit" name="Submit" value="Send">
</form>
</body>
</html>


Now, my biggest issue is that when it finishes scrolling through the iframe, it just refreshes it, so it snaps back to the start That looks pretty bad. I can fix it by putting a bunch of page breaks in the code so when it restarts, it restarts off of the bottom of the iframe, then scrolls in, but that seems like needless code, so I'm gonna see if I can do something in the CSS. You can customize it as much as you want, background image, scroll speed, colors, etc. I'm going to implement the java arrows that speed up or reverse the scroll speed. I'm sure most of you can figure that out on your own.

The way I did everything, the code is all a mess, but it works. I'll clean it up when I get a chance, but for now, if it ain't broke...fix it till it is...no wait, don't fix it. yeah.

Oh yeah, if you wanna see my version in action, check it out on my (not quite launched yet) site at
this link

(By the way, I'm not finished with the colors and function on my site, so it looks kinda crappy, but functions just fine, except for the padding issue in MSIE.)
I leave carnage in my wake.
 Quote

All times are EST. The time is now 09:02 pm.

  • Normal Topic
  • Sticky Topic
  • Locked Topic
  • New Post
  • Sticky Topic W/ New Post
  • Locked Topic W/ New Post
  •  View Anonymous Posts
  •  Able to post
  •  Filtered HTML Allowed
  •  Censored Content