Welcome Guest, Not a member yet? Register   Sign In
{elapsed_time} doesnt work when hooks are on?
#1

[eluser]chiltepin[/eluser]
Hey there.

I just recognized that {elapsed_time} will not be parsed if i use hooks (the hook i use is post controller... my first hook usage).

is this a bug or is there any way to keep it getting parsed?

ty
#2

[eluser]TheFuzzy0ne[/eluser]
I'm just guessing here, but I wouldn't have thought that elapsed_time would exist any more as the controller has finished outputting any views to the browser.

Please could you post your code?
#3

[eluser]chiltepin[/eluser]
not sure which code parts you need, i'll post a few.

the hook (http://caseyamcl.com/resources/geshiForCI):
Code:
$hook['display_override'] = array(
                                'class' => 'Geshi_hook',
                                'function' => 'run_geshi_filter',
                                'filename' => 'geshi_hook.php',
                                'filepath' => 'hooks',
                                'params' => array('line_numbers_on'));

i call the views in all of my controllers via a helper:
Code:
VL_load( $this, 'whatever_view', $data);

the helper:
Code:
function VL_load(&$ci_obj, $view, $data = array(), $hdata = array(), $fdata = array() )
    {
        if( !empty($view) )
        {
            /* ... erased ... setting some auto header and footer data here... */
            
            // ** Load views
            $ci_obj->load->view('_header', $hdata);
            $ci_obj->load->view($view, $data);
            $ci_obj->load->view('_footer', $fdata);
        }
    }
#4

[eluser]chiltepin[/eluser]
umh i'm getting a clue...

display_override
Quote:Overrides the _display() function, ...

could it be that the parsing of {elapsed_time} happens in _display()?

i thought i read 'post_controller' somewhere in the hook but not so now. hm well if this is the problem i would need to copy the {..} parsing code into the hooks display method right?

ty



BTW: is there any disadvantage in using a helper like i did to call the views?
#5

[eluser]TheFuzzy0ne[/eluser]
Sorry, I'm unable to look at the source code presently. I'm having some Vista problems, and I am currently in the process of migrating back to XP.

I wouldn't have thought you'd need to put the parsing code into your helper, you'd just need to find where the variable is stored (probably in the benchmark class) and access it that way.
#6

[eluser]chiltepin[/eluser]
the benchmark class has a method elapsed_time(...forgot...) which returns the time. but the replacement of {elapsed_time} with that value happens in the output class.

as a workaround i just copied the str_replace into the hook file i'm using.

would be better if there is any other way. i dont like to modify 3rd party stuff, makes updating a mess Wink




Theme © iAndrew 2016 - Forum software by © MyBB