Created
November 19, 2010 04:11
-
-
Save flesch/706113 to your computer and use it in GitHub Desktop.
A quick PHP/HTML5 boilerplate.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
define('APP_ROOT', pathinfo(implode('/', array_slice(explode('/', $_SERVER['PHP_SELF']), 1, 2)), PATHINFO_DIRNAME)); | |
define('DOCUMENT_ROOT', str_replace('/.', '', sprintf('%s/%s', $_SERVER['DOCUMENT_ROOT'], APP_ROOT))); | |
define('SERVER_NAME', preg_replace('#^www\.#', '', $_SERVER['SERVER_NAME'])); | |
define('SERVER_URL', sprintf('http://%s/%s', SERVER_NAME, APP_ROOT)); | |
function utime() { | |
list($usec, $sec) = explode(' ', microtime()); | |
return ((float)$usec + (float)$sec); | |
} | |
$benchmark = utime(); | |
if (!ob_start('ob_gzhandler')) { | |
ob_start(); | |
} | |
?> | |
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta charset="utf-8" /> | |
<title>·</title> | |
<!--[if IE]> | |
<script src="http://static.fles.ch/js/html5.js"></script> | |
<![endif]--> | |
<link rel="stylesheet" href="http://static.fles.ch/css/reset-min.css" /> | |
<style> | |
</style> | |
<script src="http://static.fles.ch/js/jquery-1.4.4.js"></script> | |
<link rel="shortcut icon" type="image/png" href="http://static.fles.ch/img/favicon.png" /> | |
</head> | |
<body> | |
<script> | |
</script> | |
<!-- <?php echo sprintf('Rendered in %s seconds.', number_format(utime() - $start, 3)); ?> --> | |
</body> | |
</html> | |
<?php | |
header(sprintf('Last-Modified: %s', gmdate('D, d M Y H:i:s T'))); | |
header(sprintf('Expires: %s', gmdate('D, d M Y H:i:s T', strtotime('+1 second')))); | |
header('Cache-Control: no-store, no-cache, must-revalidate'); | |
header('Content-Type: text/html'); | |
header(sprintf('Content-Length: %s', ob_get_length())); | |
ob_end_flush(); | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment