PDA

View Full Version : Promotional Hack (JS animation 4 recent posters)


11-30-2000, 06:12 PM
My first hack, a humble contribution in case anyone has a use for it.

Purpose: Encourage new members to post. Eventually will be used to run contests, promotions, etc.

What it does: When a member posts a new message, the main forum page will display a flying animation. For our diet forum, the "whoosh fairy" was appropriate (and cute). The user will see this animation until someone else posts to that forum.

In terms of rules: If the user is the last poster in any forum that is "on" the animation will show.
Can be easily modified to be more complex, but as a new forum, I hope it encourages participation.


Note: Can't figure why it doesn't work for Netscape. If you find the bug, please post here.

Needed files: animate.js from tutorial at:
http://www.webreference.com/js/column18/index.html

--

One php file to edit index.php

Find:

$lastposter="by $forum[lastposter]";

Add below:

//myhack
if ($forum[lastposter]==$bbusername and $onoff=="on"){
$greeting=1;
}
//myhack


Find:

eval("echo dovars(\"".gettemplate("forumhome")."\");");

Add above it:


//myhack
if ($greeting){
$greeting="";
eval("\$greeting .= \"".gettemplate("afairyon")."\";");
} else
{ $greeting="";}
//myhack


Add a new template, I called it afairyon:


<DIV id=whoosh
style="LEFT: -100px; WIDTH: 25px; POSITION: absolute; TOP: 800px"><IMG
src="images/flying.gif" hight=80 width=95></DIV>
<SCRIPT language=JavaScript1.2>
<!--
document.write("<SCRIPT SRC='animate.js'></SCRIPT>");
onload = start;
function start() {
anim2 = new animation("whoosh");
anim2.slideBy(600, -900, 150, 16);}
// -->
</SCRIPT>


In the forumhome template, after $footer, add:

$greeting

That's it.

Edited: Changed $username to $bbusername

[Edited by tamarian on 12-03-2000 at 11:22 PM]

12-01-2000, 04:53 AM
The reason why it doesn't work for Netscape is because it's DHTML, and a lot of DHTML is not supported by NN, btw I think it would be a better idea to have a flash animation of some sort, but I liked the hack, good job!

12-01-2000, 04:56 AM
BTW I created an account for test purposes called guest, so people can test it with out having register:

Account infor for tests:

Username: guest
Password: guest

12-01-2000, 04:58 AM
I just tested it, and I'm sorry man but I found it very annoying, especially on a large board!

12-01-2000, 03:33 PM
Originally posted by conan
BTW I created an account for test purposes called guest, so people can test it with out having register:

Account infor for tests:

Username: guest
Password: guest


Keep in mind, if you use this account, you have to delete previous recent messages by guest. If the test forum has guest as last poster and the lightbulb is "on" the animation will occur without any new post.

12-01-2000, 03:45 PM
Originally posted by conan
I just tested it, and I'm sorry man but I found it very annoying, especially on a large board!

Could be easily modified to show less frequently. My problem is that we're NOT a big board yet.

If the frequency is annoying, add a randomizer to the js scricp, something like:

var cur=Math.round(19*Math.random());
function start() {
if (cur>=17){

If the animation itself is annoying, find another one :) This particular animation is very relavent to our members, and they loved it.