Every time a page load i want to fire a custom PHP function which will notify the user in a growl style notification box if they have mail. It will show who it's from, the subject and part of the message. Problem is, I don't know where to put the PHP function and the command to fire it.
The java script needs to go in the <head></head> tags and I noticed something about extra javascript in the /templates/_header.html file but I don't know how I can incorperate my own PHP function. Here's and example of what the function looks like:
function jQueryNotifyOnMail(){
echo '
<script type="text/javascript">
$(\'#add-sticky\').click(function(){
// You can have it return a unique id, this can be used to manually remove it later using
/*
$.gritter.remove(unique_id, {
fade: true,
speed: \'fast\'
}
);
*/
var unique_id = $.gritter.add({
// (string | mandatory) the heading of the notification
title: \'This is a sticky notice!\',
// (string | mandatory) the text inside the notification
text: \'Lorem ipsum dolor sit amet, consectetur adipiscing elit. Vivamus eget tincidunt velit. Cum sociis natoque penatibus et <a href="#" style="color:#ccc">magnis dis parturient</a> montes, nascetur ridiculus mus.\',
// (string | optional) the image to display on the left
image: \'http://s3.amazonaws.com/twitter_production/profile_images/132499022/myface_bigger.jpg\',
// (bool | optional) if you want it to fade out on its own or just sit there
sticky: true,
// (int | optional) the time you want it to be alive for before fading out
time: \'\'
});
return false;
});
</script>
';
}