API15

JDocumentRendererMessage/render

From Joomla! Documentation

< API15:JDocumentRendererMessage
Revision as of 11:46, 12 May 2013 by JoomlaWikiBot (talk | contribs) (removing red link to edit, no existant pages)
The printable version is no longer supported and may have rendering errors. Please update your browser bookmarks and please use the default browser print function instead.

The "API15" namespace is an archived namespace. This page contains information for a Joomla! version which is no longer supported. It exists only as a historical reference, it will not be improved and its content may be incomplete and/or contain broken links.

Description[edit]

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[edit]

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[edit]

string The output of the script

Defined in[edit]

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

Importing[edit]

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

Source Body[edit]

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[edit]

<CodeExamplesForm />