JDocumentRendererMessage/render
From Joomla! Documentation
< API16:JDocumentRendererMessage
The "API16" 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 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]
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 transcluded page call, red link never existed >
Examples[edit]
Code Examples[edit]