Ok, so I am using a CMS (Xoops) and am trying to code a popup alert for new private messages.
I have it all figured out except for a couple things.
1) this popup pops up on any page load, and I would like it to only pop up once after the user logs in, or once after a new meesage is recieved. Any ideas?
2) I realize this is not a php question, but if you could help I would appreciate it. How can I get the pop up to center screen?
I have this script
<SCRIPT language="JavaScript1.2">
function poponload()
{
testwindow= window.open ("alert.php", "Private Messeges",
"width=250,height=50");
testwindow.moveTo(0,0);
}
</SCRIPT>
linked to load like this
<{if $xoops_isuser}><{insert name="pms"}><{/if}>
<{if $msgcount > 0}>
<body onLoad="javascript: poponload()"><{else}><body><{/if}>
and here is my alert.php file
<?
include_once "mainfile.php";
echo "<link rel=\"stylesheet\" type=\"text/css\" media=\"all\" href=\"http://localhost/xoops2/themes/Le Mank Theme/style.css\" />";//edit this to point to your style.css file
GLOBAL $xoopsUser;
$pm_handler =& xoops_gethandler('privmessage');
$uid = $xoopsUser->getVar('uid');
$criteria = new CriteriaCompo(new Criteria('read_msg', 0));
$criteria->add(new Criteria('to_userid', $uid));
$msgcount = $pm_handler->getCount($criteria);
echo "<table id=\"alert\"><tr><td id=\"alert\"><center>";
if ($msgcount > 1)
{
echo "You Have '$msgcount' New Messages!</br>";
}
else
{
echo "You Have '$msgcount' New Message!</br>";
}
echo "<a href=\"javascript:window.close();\" onclick=\"opener.location='viewpmsg.php'\">Go To Inbox</a></br><a href=\"javascript:window.close();\">Cancel</a></center></td></tr></table>";
?>
Thanks for any help.
Steve