Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- $_GET['cache'] = isset($_GET['cache']) && ctype_alpha($_GET['cache']) ? trim($_GET['cache']) : 'cache';
- switch ($_GET['cache']) {
- case 'styles' : init_css();
- break;
- case 'scripts': init_js();
- break;
- default :
- echo "Script requires an action.";
- }
- function init_css() {
- header("Content-type: text/css");
- $bgcolor = "#000";
- ?>
- body
- {
- background-color: <?php echo $bgcolor; ?>
- }
- <?
- }
- ?>
- <?php
- function init_js() {
- header("Content-type: text/javascript");
- ?>
- alert('Javascript through php file.');
- <? }
- ?>
- <link rel="stylesheet" href="cache.php?cache=styles" type="text/css" />
- <script src="cache.php?cache=scripts" type="text/javascript"></script>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement