0

Is it possible to get the length of the data that will be sent to browser when a view file is loaded?

For example,

$this->load->view("article", array("data" => $data));

I would like to know the content length that should be sent to browser. Since the data sent can also be an array, it might increase the length of the HTML content.

It is unlikely that code igniter has anything built in for this. I'm open for ideas.

Phantom
  • 1,704
  • 4
  • 17
  • 32

1 Answers1

0

do you mean like:

$data_content = $this->load->view("article", array("data" => $data), TRUE);
ob_start();
echo $data_content;
$length = ob_get_length();
ob_end_clean();
echo $length;
Sudhir Bastakoti
  • 99,167
  • 15
  • 158
  • 162
  • I just need to set content length header to get the HTML5 progress bar working. However, using third argument of view to get length was a good idea. Never thought of that. Thanks. –  Jul 08 '14 at 07:55