[geeklog-devel] Idea fro Issue 0001068

Matías Hernández Arellano msdark at archlinux.cl
Fri Apr 2 02:57:20 EDT 2010


http://project.geeklog.net/tracking/view.php?id=1068


I have and idea to do that..

write a function in lib-custom.php using jsmin-php.

The idea is that the function CUSTOM_compressJS obtained from a
specific directory (the path to the JS file as a parameter of the
function) each of the files. This function returns the JavaScript code
archives.

Now the question: How should I write that function?

Here's an example:

function CUSTOM_compressJS ( $jsdir ){
    / ** Files are read from the directory and are stored in an array
* / require_once(jsmin.php);
    $param = '';
    for ( $i=0; $i < count($jsFiles); $i++ ){
        $param += file_get_contents($jsFiles[i]);
    }
    return JSMin::minify($param);
}
is that correct? Or is better write a plugin to do that?... But I think
that kind of function should be defined within the system



More information about the geeklog-devel mailing list