TP-Docs
HTML5 Icon HTML5 Icon HTML5 Icon
TP on Social Media

Recent

Welcome to TinyPortal. Please login or sign up.

Members
  • Total Members: 3,966
  • Latest: safir45
Stats
  • Total Posts: 195,985
  • Total Topics: 21,321
  • Online today: 4,016
  • Online ever: 8,223 (February 19, 2025, 04:35:35 AM)
Users Online
  • Users: 0
  • Guests: 366
  • Total: 366

Page Refresh with new SHOUT

Started by borgBOB, April 29, 2005, 07:58:12 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

borgBOB

Hey Bloc,

Is there a way to get a 'page refresh' when a new shout is posted?
I know this might be bad if you are writing a post, but I believe some shouts are missed by my users. Of course, a chat feature could also cure that. ;)

JonasNZ

is a possibility to have the actuall shouts in an iframe, that can have a meta refresh set to 30 sec?

Bjørn

You said it..its more of an "chat" if some kind of refresh is performed on the shoubox.

I might add some sort of "new" feature to it, but it would require storage of unread/read info.

JonazNZ, since it is an integral part of the TP, that would mean you have to load TP again in that window with a special setting of just shwoing the shoutbox...or make a seprate file that gets the info from the table that holds the shouts.

The latter could be done, but it is an awkard method for just making it refresh.   

clemenzo

I also find autoscroll annoying. How about just a iframe and refresh the shouts when the Shout! button is clicked?

I think it kind of add extra load on server to refresh the whole page when a shout is added.

bloc

Thats why I made it refresh only upon new pageload. Because you are looking at another page anyhow. Making it refresh by itself in a iframe, will load in all TP anyway, so thats additonal load. And it would make it more like chat...which it really isn't.

USO_Joe

I just created a little javascript block with a refresh snippet in it so my whole page refreshes every 5 minutes. The reason everyone wants this, Bloc, is so that they can leave their computer up, on the web page, and have it refresh often enough to show you that someone is on your web site ... that way if you're doing something else, you can look over and see what's being talked about without having to click the mouse. You wouldn't have to make it a regular 5-second refresh or anything... I think most people would be satisfied with a 30-second or one minute refresh rate.

camflan

how about an AJAX version?  that would fix ALL problems.  it would keep server load low, refresh automatically when there is new shouts, and not just when you set up a refresh..which may or may not reveal new shouts.  AJAX would definatly be more of a live "chat" refresh, but I think most of us use the shoutbox in this fashion more than anything. :thumbup:

crip


crip


moviespot

#9
it will be great if used an ajax to refresh when post ..


This code is not working fine need to be fixed don't put it directly to block


OK. I'll show you how I have done it. Maybe it can be done in a better way. Let me just tip you to read this article, that I am reading right now:

http://developer.apple.com/internet...ipt/iframe.html

It's about remote scripting with iframe. I think it can help alot of people out there. Enough talk, here comes the script:


This is the main file that calls the the hidden frame. It loads the file containing the database scroll, and unloads it when finished.


<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<HTML>
<HEAD>
<LINK REL=StyleSheet HREF="<? echo $styledir ?>stylesheet.css" TYPE="text/css" TITLE="Stylesheet">
<SCRIPT LANGUAGE='JAVASCRIPT'>
function Updatenadaframe() {
parent.nadaright.location.href='<? echo $auctiondir ?>getdetail.php?lang=<?echo $lang ?>&obj=<?echo $obj?>&orgval=<?echo $orgval?>';
}

function Backnadaframe() {
parent.nadaright.location.href='<? echo $framesetdir ?>nada.php';
}
// -->
</SCRIPT>
</HEAD>

<BODY onLoad="Updatenadaframe();" onUnload="Backnadaframe();">



This is the content of the file "getdetail.php" that is loaded into the hidden frame that checks the DB for changes. The page is refreshed every 10 second and is passing parameters to itself.


selectDB();

$query = mysql_query("SELECT BiddingPrice, RegUserID, UNIX_TIMESTAMP(Biddingtime) FROM Bidding WHERE ArtObjectID=".$obj." ORDER BY BiddingTime")

or die("Problems with Query - checkbidchange");

mysql_close();

$newval = mysql_num_rows($query);

if ($newval <> $orgval) { // Is there any change in DB?

$update = 1;

$orgval = $newval;

}

?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<HTML>
<HEAD>
<META HTTP-EQUIV=refresh CONTENT="10;URL=getdetail.php?<? echo "obj=".$obj."&orgval=".$orgval."&lang=".$lang ?>">

<?php

print "\n<SCRIPT LANGUAGE='JAVASCRIPT'>";

print 
"\n\nfunction updatedetail() {";

print 
"\nalert('"Changes are made in the databaseReloading page!"')";
print 
"\nparent.content.location.href='".$framesetdir."detail.php?lang=".$lang."&obj=".$obj."&pageid=".$pageid."';";

print 
"\n}";

print 
"\n</SCRIPT>";

?>


</HEAD>

<?php

if ($update == 1) {

print 
"\n<BODY onLoad=\"updatedetail()\">";

} else {

print 
"<BODY>";

}

print 
"</BODY>";

print 
"</HTML>";


I hope it makes some sense to you!

This website is proudly hosted on Crocweb Cloud Website Hosting.