mattle
09-10-2009, 08:56 AM
Okay, this is is kind of a weird one. I'm working on a site where pretty much every page is /index.php, and then different form vars trigger different include files. I'm tracking user messages, warnings, etc. in a global var and then the last thing that index.php does is populate a popup div if there are any messages to display. Works great.
Problem is that a lot of page executions are called by ajax and index.php doesn't get called again. I've got a separate function which will populate and show the message popUp in an ajax execution, but the problem is calling it once at the end of the script execution. It's handled in a normal request since index.php is called and I can just slap it at the end. In an XML request, however, there could be any variety of pages being called, and I'm trying to avoid having to fire off this function at the end of every one of them. I have a common functions file that is included on every page already, so that seems like the best candidate, but the trick is getting it to fire at the end.
I've attempting this:
pcntl_signal(SIGTERM, "showAjaxMsg");but it would appear that our version of PHP was not compiled with --enable-pcntl. I'm running on a corporation wide, controlled RPM, so re-compiling is not an option. Anyone have any other ideas to set a function to fire at the end of script execution?
Problem is that a lot of page executions are called by ajax and index.php doesn't get called again. I've got a separate function which will populate and show the message popUp in an ajax execution, but the problem is calling it once at the end of the script execution. It's handled in a normal request since index.php is called and I can just slap it at the end. In an XML request, however, there could be any variety of pages being called, and I'm trying to avoid having to fire off this function at the end of every one of them. I have a common functions file that is included on every page already, so that seems like the best candidate, but the trick is getting it to fire at the end.
I've attempting this:
pcntl_signal(SIGTERM, "showAjaxMsg");but it would appear that our version of PHP was not compiled with --enable-pcntl. I'm running on a corporation wide, controlled RPM, so re-compiling is not an option. Anyone have any other ideas to set a function to fire at the end of script execution?
