Actions

API15

JDocumentRendererMessage/render

From Joomla! Documentation

< API15:JDocumentRendererMessage
Revision as of 11:46, 12 May 2013 by JoomlaWikiBot (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Replacement filing cabinet.png
This Namespace has been archived - Please Do Not Edit or Create Pages in this namespace. Pages contain information for a Joomla! version which is no longer supported. It exists only as a historical reference, will not be improved and its content may be incomplete.

Contents

Description

Renders the error stack and returns the results as a string

[<! removed edit link to red link >]

<! removed transcluded page call, red link never existed >

Syntax

render($name=null, $params=array(), $content=null)
Parameter Name Default Value Description
$name null $name (unused)
$params array() $params Associative array of values
$content null

Returns

string The output of the script

Defined in

libraries/joomla/document/html/renderer/message.php

Importing

jimport( 'joomla.document.html.renderer.message' );

Source Body

function render($name = null, $params = array (), $content = null)
{
        global $mainframe;
 
        // Initialize variables
        $contents       = null;
        $lists          = null;
 
        // Get the message queue
        $messages = $mainframe->getMessageQueue();
 
        // Build the sorted message list
        if (is_array($messages) && count($messages)) {
                foreach ($messages as $msg)
                {
                        if (isset($msg['type']) && isset($msg['message'])) {
                                $lists[$msg['type']][] = $msg['message'];
                        }
                }
        }
 
        // If messages exist render them
        if (is_array($lists))
        {
                // Build the return string
                $contents .= "\n<dl id=\"system-message\">";
                foreach ($lists as $type => $msgs)
                {
                        if (count($msgs)) {
                                $contents .= "\n<dt class=\"".strtolower($type)."\">".JText::_( $type )."</dt>";
                                $contents .= "\n<dd class=\"".strtolower($type)." message fade\">";
                                $contents .= "\n\t<ul>";
                                foreach ($msgs as $msg)
                                {
                                        $contents .="\n\t\t<li>".$msg."</li>";
                                }
                                $contents .= "\n\t</ul>";
                                $contents .= "\n</dd>";
                        }
                }
                $contents .= "\n</dl>";
        }
        return $contents;
}

[<! removed edit link to red link >] <! removed transcluded page call, red link never existed >

Examples

<CodeExamplesForm />