API15:JDocumentRendererMessage/render
From Joomla! Documentation
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
Code Examples