Source for file function.jmessage.php

Documentation is available at function.jmessage.php

  1. <?php
  2. /**
  3. @package     jelix
  4. @subpackage  jtpl_plugin
  5. @author      Loic Mathaud
  6. @copyright   2008 Loic Mathaud
  7. @link        http://www.jelix.org
  8. @licence     GNU Lesser General Public Licence see LICENCE file or http://www.gnu.org/licenses/lgpl.html
  9. */
  10.  
  11. /**
  12. * function plugin :  Display messages from jMessage
  13. */
  14.  
  15. function jtpl_function_html_jmessage($tpl$type ''{
  16.     // Get messages
  17.     if ($type == ''{
  18.         $messages jMessage::getAll();
  19.     else {
  20.         $messages jMessage::get($type);
  21.     }
  22.     // Not messages, quit
  23.     if (!$messages{
  24.         return;
  25.     }
  26.  
  27.     // Display messages
  28.     if ($type == ''{
  29.         echo '<ul class="jelix-msg">';
  30.         foreach ($messages as $type_msg => $all_msg{
  31.             foreach ($all_msg as $msg{
  32.                 echo '<li class="jelix-msg-item-'.$type_msg.'">'.htmlspecialchars($msg).'</li>';
  33.             }
  34.         }
  35.     else {
  36.         echo '<ul class="jelix-msg-'$type .'">';
  37.         foreach ($messages as $msg{
  38.             echo '<li class="jelix-msg-item-'.$type.'">'.htmlspecialchars($msg).'</li>';
  39.         }
  40.     }
  41.     echo '</ul>';
  42.  
  43.     if ($type == ''{
  44.         jMessage::clearAll();
  45.     else {
  46.         jMessage::clear($type);
  47.     }
  48.     
  49. }

Documentation generated on Mon, 19 Sep 2011 14:11:41 +0200 by phpDocumentor 1.4.3