Actions

API16

JDocumentRendererMessage/render

From Joomla! Documentation

< API16:JDocumentRendererMessage
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

public function render($name = null, $params = array (), $content = null)
{
        // Initialise variables.
        $buffer = null;
        $lists  = null;
 
        // Get the message queue
        $messages = JFactory::getApplication()->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
                $buffer .= "\n<dl id=\"system-message\">";
                foreach ($lists as $type => $msgs)
                {
                        if (count($msgs))
                        {
                                $buffer .= "\n<dt class=\"".strtolower($type)."\">".JText::_($type)."</dt>";
                                $buffer .= "\n<dd class=\"".strtolower($type)." message fade\">";
                                $buffer .= "\n\t<ul>";
                                foreach ($msgs as $msg) {
                                        $buffer .="\n\t\t<li>".$msg."</li>";
                                }
                                $buffer .= "\n\t</ul>";
                                $buffer .= "\n</dd>";
                        }
                }
                $buffer .= "\n</dl>";
        }
        return $buffer;
}

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

Examples

<CodeExamplesForm />