Welcome Guest, Not a member yet? Register   Sign In
Debug helper
#6

[eluser]woeps[/eluser]
I really like your helper! Thanks!
But I had to change the echo-statements to put the whole output of each method into a variable and then return this; because if I echo the ouput there will be problems using sessions or "not-default" header.
Now the methods look like this:
Code:
/**
* Outputs an array or variable
*
* @param    $var array, string, integer
* @return    string
*/

    function debug_var($var = '')
        {
        $return = _before();
            if (is_array($var))
            {
                $return .= print_r($var, true);
            }
                else
            {
                $return .= $var;
            }
            $return .= _after();
        return $return;
        }

//------------------------------------------------------------------------------

/**
* _before
*
* @return    string
*/
    function _before()
    {
        $before = '<div style="padding:10px 20px 10px 20px; background-color:#fbe6f2; border:1px solid #d893a1; color: #000; font-size: 12px;>'."\n";
        $before .= '<h5 style="font-family:verdana,sans-serif; font-weight:bold; font-size:18px;">Debug Helper Output</h5>'."\n";
        $before .= '<pre>'."\n";
        return $before;
    }
    
//------------------------------------------------------------------------------

/**
* _after
*
* @return    string
*/

    function _after()
    {
        $after = '</pre>'."\n";
        $after .= '</div>'."\n";
        return $after;
    }
Now I can use this helper with sessions, redirects, etc.
Thanks!


Messages In This Thread
Debug helper - by El Forum - 09-26-2009, 05:42 AM
Debug helper - by El Forum - 10-19-2009, 06:48 AM
Debug helper - by El Forum - 10-20-2009, 09:44 AM
Debug helper - by El Forum - 11-13-2009, 10:00 AM
Debug helper - by El Forum - 01-04-2010, 02:04 AM
Debug helper - by El Forum - 11-02-2010, 02:05 PM



Theme © iAndrew 2016 - Forum software by © MyBB