. # This file is useful for putting message box(es) on the screen. If you include # session_messages.php these messages can even persist accross http redirects # (such as you should do after receiving a POST. # # Just call message("message here") whenever you have something to report. # # # Once a template is loaded, call display_messages(). run.php will do that # automatically after your main function returns, so long as you require_once # this file. # # Just make sure your template has a section with a # ~value html~ tag in it. # # Simple example: # # #

~value html~

# # # Full-featured example: # # # #
# #

~data html~

# #
# # #
# # require_once('code/wfpl/template.php'); function message($msg) { if(!isset($GLOBALS['wfpl_messages'])) { $GLOBALS['wfpl_messages'] = array(); } $GLOBALS['wfpl_messages'][] = $msg; } function get_messages() { if(!isset($GLOBALS['wfpl_messages'])) { $messages = array(); } else { $messages = $GLOBALS['wfpl_messages']; unset($GLOBALS['wfpl_messages']); } if(function_exists('session_restore_messages')) { $messages = array_merge(session_restore_messages(), $messages); } return $messages; } # for old-style templates function display_messages(&$tem = NULL, $key = 'wfpl_messages') { if($tem) { $tem->data[$key] = columnize(get_messages()); } else { $GLOBALS['wfpl_template']->data[$key] = columnize(get_messages()); } }