Actions

API16

JError/renderBacktrace

From Joomla! Documentation

< API16:JError
Revision as of 16:44, 22 March 2010 by Doxiki (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.

[Edit Descripton]

Description:JError/renderBacktrace

Contents

Syntax

static renderBacktrace($error)
Parameter Name Default Value Description
$error

Defined in

libraries/joomla/error/error.php

Importing

jimport( 'joomla.error.error' );

Source Body

public static function renderBacktrace($error)
{
        $contents       = null;
        $backtrace      = $error->getTrace();
        if (is_array($backtrace))
        {
                ob_start();
                $j = 1;
                echo '<table border="0" cellpadding="0" cellspacing="0" class="Table">';
                echo '          <tr>';
                echo '                          <td colspan="3" align="left" class="TD"><strong>Call stack</strong></td>';
                echo '          </tr>';
                echo '          <tr>';
                echo '                          <td class="TD"><strong>#</strong></td>';
                echo '                          <td class="TD"><strong>Function</strong></td>';
                echo '                          <td class="TD"><strong>Location</strong></td>';
                echo '          </tr>';
                for ($i = count($backtrace)-1; $i >= 0 ; $i--)
                {
                        echo    '               <tr>';
                        echo    '                               <td class="TD">'.$j.'</td>';
                        if (isset($backtrace[$i]['class'])) {
                                        echo    '               <td class="TD">'.$backtrace[$i]['class'].$backtrace[$i]['type'].$backtrace[$i]['function'].'()</td>';
                        } else {
                                        echo    '               <td class="TD">'.$backtrace[$i]['function'].'()</td>';
                        }
                        if (isset($backtrace[$i]['file'])) {
                                        echo    '                               <td class="TD">'.$backtrace[$i]['file'].':'.$backtrace[$i]['line'].'</td>';
                        } else {
                                        echo    '                               <td class="TD">&nbsp;</td>';
                        }
                        echo    '               </tr>';
                        $j++;
                }
                echo '</table>';
                $contents = ob_get_contents();
                ob_end_clean();
        }
        return $contents;
}

[Edit See Also] SeeAlso:JError/renderBacktrace

Examples

<CodeExamplesForm />