• Hi I would like to use this exactly method below – compression php script for faster loading.
    That is ricky for me, though I am trying this on localhost.
    I followed steps herehttps://code.google.com/p/compress/
    though couldn’t find a way to handle with it.

    Can anybody tell how to combine this code with WordPress child theme?

    //		prepare combined, minfied and combined, minified and gzipped css and js files
    file_compress('css_schedule.css',array('../CSS/menu.css','../CSS/ThreeColumnFixed.css','../CSS/sprite.css','../CSS/iCal.css'));
    file_compress('css_non_schedule.css',array('../CSS/menu.css','../CSS/ThreeColumnFixed.css','../CSS/sprite.css'));
    file_compress('css_schedule_ie7.css',array('../CSS/menuIE.css','../CSS/ThreeColumnFixed.css','../CSS/sprite.css','../CSS/iCal.css'));
    file_compress('css_non_schedule_ie7.css',array('../CSS/menuIE.css','../CSS/ThreeColumnFixed.css','../CSS/sprite.css'));
    file_compress('css_ie6.css',array('../CSS/menuIE6.css','../CSS/ThreeColumnFixedIE6.css','../CSS/sprite.css'));
    file_compress('js_schedule.js',array('../JS/Schedule.js','../JS/iCal.js','../JS/Findit.js','../JS/UlScroll.js','../ExternalConnect/External.js'));
    file_compress('js_non_schedule.js',array('../JS/Findit.js','../JS/UlScroll.js','../ExternalConnect/External.js'));

    There are some plugins, but…
    I do not use plugins intendly trying to learn a bit of server side.

Viewing 1 replies (of 1 total)
  • Thread Starter whoiam

    (@whoiam)

    Is that right way to place code into functions.php or directly into header.php ?

    require_once('compress_timestamp.php');         //load timestamp created by compress.php module sets field $compress_stamp=unix_timestamp
    if (stripos($_SERVER['HTTP_ACCEPT_ENCODING'],'GZIP')!==false)
            $gz='gz';
     else
            $gz=null;
    echo '<link rel="stylesheet" type="text/css" href="min/css_schedule_'.$compress_stamp.'.css'.$gz.'" />',PHP_EOL;
    //    the following scripts were combined into css_schedule
          echo '<link rel="stylesheet" type="text/css" href="style.css" />',PHP_EOL;
          echo '<link rel="stylesheet" type="text/css" href="../twentyfourteen/style.css" />',PHP_EOL;
    //      echo '<link rel="stylesheet" type="text/css" href="CSS/sprite.css" />',PHP_EOL;
    //      echo '<link rel="stylesheet" type="text/css" href="CSS/iCal.css" />',PHP_EOL;

    I indicated paths to css files: child and parent, but no data in compress_timestamp.php appears. Where am I wrong?

Viewing 1 replies (of 1 total)
  • The topic ‘Compression with PHP’ is closed to new replies.