Welcome Guest, Not a member yet? Register   Sign In
Output Class - disable parsing of execution variables
#1

[eluser]Unknown[/eluser]
Hi,

If you want to disable (whatever reason you might have) execution variables like {elapsed_time}:

In the documentation it just says to set
Code:
$this->output->parse_exec_vars = FALSE;
in your controller. However this does not work for me because you are trying to access a protected property.

However, this can be resolved pretty easy. Just extend the output class in your "core" directory (My_Output.php):
Code:
<?php  if ( ! defined('BASEPATH')) exit('No direct script access allowed');

class MY_Output extends CI_Output {

  protected $parse_exec_vars = FALSE;
  
}

So my question - is this the intended way? If so the documentation should be a bit clearer..
#2

[eluser]Harold Villacorte[/eluser]
It looks to me like you are correct. load_class() instantiates the object as opposed to extending the class so $this->output->parse_exec_vars = FALSE would not work. Unless I am overlooking something extending the core class like you are doing is the only way to access the protected property.

I have not tested it but shouldn't you be able to set the $parse_exec_vars property like this $this->parse_exec_vars = FALSE from within the MY_Output class since the property is inherited? That is not necessarily an answer I am giving but a question I am asking as well.
#3

[eluser]Aken[/eluser]
The property has been made public as of 3.0, so this won't be an issue in the future. If you want to adjust it in earlier versions, you can just change it to public manually in your system/core/Output.php file, or extend the class if you want.




Theme © iAndrew 2016 - Forum software by © MyBB