To jest tylko wersja do druku, aby zobaczyć pełną wersję tematu, kliknij TUTAJ
phpBB2 by Przemo
Support forów phpBB2 modified by Przemo

English version - Use AJAX to refresh shoutbox????

petekin74 - 04-08-2006, 14:47
Temat postu: Use AJAX to refresh shoutbox????
Im using przemo 1.2.5

I asked this in the bottom of a post a while ago and never got a responce. So just fiqured I would try it again.

Does anybody know if it is possible to use AJAX to automatically refresh the shoutbox on a przemo forum. And if yes, maybe they could give a example.

Thanks

Crack - 19-08-2006, 17:50

Why AJAX? Adding a META refresh header will make your browser refresh shoutbox automatically. If you insist on using JS, I would recomend simple refreshing function combined with a timeout will suffice - much simplier, more backwards compatible and smaller code. An example in pseudo-JS (should be put below iframe code in the document):
Kod:
function shoutbox_refresh()
{
  // get shoutbox iframe and refresh it
  document.getElelementById('shoutbox_iframe_id').refreshItSomehow;
  // call this function again in 10 seconds
  setTimeout(10000, shoutbox_refresh);
}
// call shoutbox_refresh() in 10 seconds
setTimeout(10000, shoutbox_refresh);

petekin74 - 19-08-2006, 18:13

can you give me a example of the meta refresh header?
irekk - 19-08-2006, 21:48

please, next time use google

Kod:
<meta http-equiv="refresh" content="10">

10 - time in seconds

petekin74 - 21-08-2006, 03:33

ok, I put that in between the <iframe> tags, but it doesnt seem to be working. If I move it out of there it refreshes the whole board. Any ideas where this should go.
azwel - 28-08-2006, 15:38

petekin74, put it in the shoutbox file not index.
petekin74 - 28-08-2006, 16:28

which one?

I have
admin_shoutbox.php
shoutbox_body.tpl
shoutbox_config_body.tpl
shoutbox_view_body.tpl
shoutbox_view.php
shoutbox.php

azwel - 28-08-2006, 18:46

shoutbox_view_body.tpl
petekin74 - 28-08-2006, 18:48

Thank you
mafoo - 28-10-2006, 22:26

I know this isn't supported anymore but if some one could help me it would be appreciated. If not completely understand. When I use a metatag refresh on shoutbox_view.php I get this error:

Kod:
Warning: Cannot modify header information - headers already sent by (output started at D:\***\***\wwwroot\forum\shoutbox_view.php:4) in D:\***\***\wwwroot\forum\includes\sessions.php on line 367


I am using an iframe to display it and plan on having it on many different pages :D

azwel - 29-10-2006, 13:06

mafoo, put it in the shoutbox_view_body.tpl in head section, below this
Kod:
<meta http-equiv="Content-Style-Type" content="text/css">

So it should look like that:
Kod:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<head>
 <meta http-equiv="Content-Type" content="text/html; charset={S_CONTENT_ENCODING}">
 <meta http-equiv="Content-Style-Type" content="text/css">
 <meta http-equiv="refresh" content="60">
 <link rel="stylesheet" href="templates/subSilver/subSilver.css" type="text/css" />
</head>
<body leftmargin="0" topmargin="0" marginwidth="0" marginheight="0" bgcolor="#E5E5E5" text="#000000" link="#006699" vlink="#5493B4" onload="window.scrollTo(0,99999);" />
 <!-- BEGIN shoutrow -->
 <table cellpadding="2" cellspacing="0" border="0" class="table0" width="100%">
  <tr>
    <td class="{shoutrow.ROW_CLASS}" width="100%"><span class="gensmall">
    <font style="font-size:9px; font-family: Tahoma, Verdana, Arial, Helvetica, sans-serif">{shoutrow.DELMSG} {shoutrow.EDITMSG} {shoutrow.DATE} </font>
    <b>{shoutrow.NAME}: </b>{shoutrow.MSG}</span></td>
  </tr>
 </table>
<!-- END shoutrow -->
</body>
</html>

excess - 03-04-2007, 17:22

Hey, apologies for posting in an old thread, but i have used the META tag to refresh my shoutbox on the forum, and a user has reccomended an option to turn this off, i am not very experianced in the modifying of phpbb.

Is there any way i could edit the shoutbox to (if i set a profile option to have auto refresh on) read the mySQL database and determine whether it refreshed itself or not.

Thanks
- Rob.



Powered by phpBB modified by Przemo © 2003 phpBB Group