Gestione JS locali

This commit is contained in:
cmaffio
2018-08-22 17:40:35 +02:00
parent 6bc0a4eabb
commit 7cc89cee0d
2 changed files with 19 additions and 0 deletions

View File

@@ -701,4 +701,20 @@ function addslashes_array ($value) {
return $value;
}
function caricajs () {
$script = $_SERVER["PHP_SELF"];
$base = $_SERVER["DOCUMENT_ROOT"];
$path_parts = pathinfo($script);
$path = $path_parts['dirname'];
$noext = $path_parts['filename'];
$js = "$path/jsl/$noext.js";
$js_test = "$base$path/jsl/$noext.js";
if (file_exists ($js_test)) {
print "\t<script src=\"$js\"></script>";
}
}
?>

View File

@@ -23,6 +23,9 @@
});
</script>
<?php caricajs() ; ?>
</head>
<body>
<link rel="stylesheet" type="text/css" href="<?php print $CONF['base_url'] ?>/css/stile.css" />