[eluser]altrano[/eluser]
[quote author="mawi27" date="1287925029"]Hi,
to extend the Profiler you have to create a file MY_Profiler.php in applications/libraries
In this file you can define overwrites for the original profiler functions.
This code example works for CI2.0, in CI1.7.2 the usage is a bit different.
Code:
/**
* extend ci2 profiler
*
*/
class MY_Profiler extends CI_Profiler {
function MY_Profiler($config = array())
{
// add your needed sections to the _available_sections array here
$this->_available_sections[] = 'mysection';
$this->_available_sections[] = 'session';
parent::CI_Profiler($config);
}
// for each new section define the output like in this example for sessions
// function name: _compile_mysection
/**
* Adds ... to profiler
*/
function _compile_mysection() {}
/**
* Adds session data to the profiler
* @return string
*/
function _compile_session()
{
$output = "\n\n";
$output .= '<fieldset style="border:1px solid #009999;padding:6px 10px 10px 10px;margin:20px 0 20px 0;background-color:#eee">';
$output .= "\n";
$output .= '<legend style="color:#009999;"> ' . 'SESSION DATA' . ' </legend>';
$output .= "\n";
if (!is_object($this->CI->session))
{
$output .= "<div style='color:#009999;font-weight:normal;padding:4px 0 4px 0'>" . 'No SESSION data exists' . "</div>";
}
else
{
$output .= "\n\n<table cellpadding='4' cellspacing='1' border='0' width='100%'>\n";
$sess = get_object_vars($this->CI->session);
foreach ($sess['userdata'] as $key => $val)
{
if (!is_numeric($key))
{
$key = "'" . $key . "'";
}
$output .= "<tr><td width='50%' style='color:#000;background-color:#ddd;'>$_SESSION[" . $key . "] </td><td width='50%' style='color:#009999;font-weight:normal;background-color:#ddd;'>";
if (is_array($val))
{
$output .= "<pre>" . htmlspecialchars(stripslashes(print_r($val, true))) . "</pre>";
}
else
{
$output .= htmlspecialchars(stripslashes($val));
}
$output .= "</td></tr>\n";
}
$output .= "</table>\n";
}
$output .= "</fieldset>";
return $output;
}
}
/* End of file MY_Profiler.php */
/* Location: ./application/libraries/MY_Profiler.php */
Marco[/quote]
Thanks what is the different between 2.0 1.7.2 for this modifications?
Not anyone have this do with 1.7.2 ??