Fire Custom PHP Function

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>
';
}

Quote · 2 Sep 2009

Hi everyone, thanks to the great help on this forum I figured it out myself, I made a custom block on the page I needed it to fire on in phpmyadmin and just shoved the PHP in to there manually.

Quote · 4 Sep 2009
 
 
Below is the legacy version of the Boonex site, maintained for Dolphin.Pro 7.x support.
The new Dolphin solution is powered by UNA Community Management System.