-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathexample.php
More file actions
36 lines (29 loc) · 891 Bytes
/
example.php
File metadata and controls
36 lines (29 loc) · 891 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
<?php
include_once './config.php';
// Dynamically adjust the JS and CSS file list per page, per your wish
$js_files = array(
'{base}/js/jquery.min.js',
'{base}/js/spinner.js',
'{template}/js/somejs_file.js',
);
$css_files = array(
'{base}/css/jquery-ui.css',
'{template}/css/nightwolf.css',
);
// CSS and JS cache
foreach (array('css', 'js') as $type) {
${$type . '_cache'} = md5(implode(',', ${$type . '_files'}));
// This specific js/css list is not cached before
if (!is_file($env['cache'] . '/' . $type . '-' . ${$type . '_cache'}))
file_put_contents($env['cache'] . '/' . $type . '-' . ${$type . '_cache'}, implode("\n", ${$type . '_files'}));
}
?>
<html>
<head>
<link rel="stylesheet" href="<?=$env['base'];?>/jcss.php?t=c&f=<?=$css_cache;?>">
</head>
<body>
Site Content
<script src="<?=$env['base'];?>/jcss.php?t=j&f=<?=$js_cache;?>"></script>
</body>
</html>