Search This Blog

Thursday, May 6, 2010

Including Javascript Files

function includeJavascriptFiles()
{
    global $smarty, $template;

    $nArgs = func_num_args();
    $args = func_get_args();

    for( $i = 0; $i < $nArgs; $i++ )
    {
        $file = $args[$i];
?>
        $appRoot = $smarty->get_config_vars('APPLICATON_ROOT');
        $ts = filemtime( "$appRoot/templates/$template/js/$file.js" );
        <script type="text/javascript" src="<? echo "templates/$template/js/$file.js?ts$ts=1"?>"></script>
<?php

    }
}

No comments:

Post a Comment