/*ОПОВЕЩЕНИЯ ЧРЕЗ АЯКС*/
?>
<div id="content"></div>
<script>
function show()
{
$.ajax({
url: "../opov_web/",
cache: false,
success: function(html){
$("#content").html(html);
}
});
}
$(document).ready(function(){
show();
setInterval('show()',60000);
});
</script>
<?php
создавем папку opow_web в ней файл index.php
index.php - 4.4.0 в других версиях хз..
<?php
define('_IN_JOHNCMS', 1);
require_once ('../incfiles/core.php');
if ($user_id) {
$list = array();
$new_sys_mail = mysql_result(mysql_query("SELECT COUNT(*) FROM `cms_mail` WHERE `from_id`='$user_id' AND `read`='0' AND `sys`='1' AND `delete`!='$user_id';"), 0);
if ($new_sys_mail) $list[] = '<td class="top"><a href="' . $home . '/mail/index.php?act=systems"><img src="/images/mail_sys.png" width="16" height="16" alt="" /> Система (+' . $new_sys_mail . ')</a></td>';
$new_mail = mysql_result(mysql_query("SELECT COUNT(*) FROM `cms_mail` LEFT JOIN `cms_contact` ON `cms_mail`.`user_id`=`cms_contact`.`from_id` AND `cms_contact`.`user_id`='$user_id' WHERE `cms_mail`.`from_id`='$user_id' AND `cms_mail`.`sys`='0' AND `cms_mail`.`read`='0' AND `cms_mail`.`delete`!='$user_id' AND `cms_contact`.`ban`!='1' AND `cms_mail`.`spam`='0'"), 0);
if ($new_mail) $list[] = '<td class="top"><a href="' . $home . '/mail/index.php?act=new">' . $lng['mail'] . ' <br />+' . $new_mail . '</a></td>';
$totallibrary = mysql_result(mysql_query("SELECT COUNT(*) FROM `myjornal` WHERE `login`='$login' AND `chit`='0' AND `del`='0' "), 0);
if ($totallibrary) $list[] = '<td class="top"><a href="' . core::$system_set['homeurl'] . '/library/jornal.php">Произведения <br />+' . $totallibrary . '</a></td>';
if ($datauser['comm_count'] > $datauser['comm_old']) $list[] = '<td class="top"><a href="' . core::$system_set['homeurl'] . '/users/profile.php?act=guestbook&user=' . $user_id . '">' . $lng['guestbook'] . ' <br />+' . ($datauser['comm_count'] - $datauser['comm_old']) . '</a></td>';
$new_album_comm = mysql_result(mysql_query("SELECT COUNT(*) FROM `cms_album_files` WHERE `user_id` = '" . $user_id . "' AND `unread_comments` = 1"), 0);
if($new_album_comm) $list[] = '<td class="top"><a href="' . core::$system_set['homeurl'] . '/users/album.php?act=top&mod=my_new_comm">Отзывы к<br />Фото</a></td>';
if ($datauser['journal_forum']) $list[] = '<td class="top"><a href="' . core::$system_set['homeurl'] . '/users/journal.php">Форум<br />+' .$datauser['journal_forum']. '</a></td>';
if (!empty($list)) {
echo '<table class="www" width="100%"><tr><td width="10%">' . $lng['unread'] . ':</td>' . functions::display_menu($list,'') . '</tr></table>';
}
}
в эту же папку кидаем прикрепленный файл jquery.js
и пишем в head.php такое вот..
<script type="text/javascript" src="' . $set['homeurl'] . '/opov_web/jquery.js"></script>