Welcome Guest, Not a member yet? Register   Sign In
Google ads + .htaccess + CI routing = 400 Bad Request
#4

[eluser]John_Betong_002[/eluser]
Here is how I compress the final output:
Code:
//==============================================
function _compress(& $result='')
{
  $_SESSION['zzz_after']  = ''; // strlen($result);
  $_SESSION['zzz_before'] = strlen($result);

  $search = array(
      '/\>[^\S ]+/s',   //strip whitespaces after tags, except space
      '/[^\S ]+\</s',   //strip whitespaces before tags, except space
      '/(\s)+/s'        // shorten multiple whitespace sequences
      );
  $replace = array(
      '>',
      '<',
      '\\1'
      );
  $result = preg_replace($search, $replace, $result);

  // Problem: DOES NOT COMPRESS ADVERTS ?????
  // $hex=array("\x0D","\x0A");
  // $result=str_replace($hex,'',$result);

  $_SESSION['zzz_after'] = strlen($result);

  // $result .= '<p>Source code reduced by:'.sprintf('%6.3f', $_SESSION['zzz_after'] / $_SESSION['zzz_before']) .'%</p>';
  /*
  if(FALSE) // DABS this on the end after &lt;/body?&lt;/html>
  {
    $result .=  '<p>Source code: goes here'. jj
            .       'Before: '      . number_format($_SESSION['zzz_before'])  . jj
            .       'After: &nbsp;' . number_format($_SESSION['zzz_after'])   . jj
            .       'Saving: '      . number_format($_SESSION['zzz_before'] - $_SESSION['zzz_after']) .' bytes'
            .   '</p>';
  }
  */

  return $result;
}//endfunc
&nbsp;
&nbsp;
edit: view source on this page:
&nbsp;http://johns-jokes.com/2012-World-Cannot...cause.html


Messages In This Thread
Google ads + .htaccess + CI routing = 400 Bad Request - by El Forum - 06-29-2011, 06:48 PM
Google ads + .htaccess + CI routing = 400 Bad Request - by El Forum - 06-29-2011, 07:29 PM
Google ads + .htaccess + CI routing = 400 Bad Request - by El Forum - 06-29-2011, 07:51 PM
Google ads + .htaccess + CI routing = 400 Bad Request - by El Forum - 06-29-2011, 08:16 PM



Theme © iAndrew 2016 - Forum software by © MyBB