Implement base env detection + simple templating

This commit is contained in:
Bofh 2021-11-24 21:50:30 +01:00
parent e6bf477386
commit adda2114e5
4 changed files with 31 additions and 0 deletions

6
src/base.php Normal file
View File

@ -0,0 +1,6 @@
<?php
$env = 'prod';
if (getenv('ENV') !== false && in_array(getenv('ENV'), ['prod', 'dev']))
$env = getenv('ENV');
define('ENV', $env);

3
src/cron.php Normal file
View File

@ -0,0 +1,3 @@
<?php
if (isset($_SERVER['HTTP_USER_AGENT'])) die;

2
src/views/foot.php Normal file
View File

@ -0,0 +1,2 @@
</body>
</html>

20
src/views/head.php Normal file
View File

@ -0,0 +1,20 @@
<html>
<head>
<meta charset="utf-8" />
<title><?php echo isset($p['title']) ? $p['title'] : '' ?></title>
<meta name="description" content="">
<meta name="author" content="">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="stylesheet" type="text/css" href="/css/normalize.css?v=1">
<link rel="stylesheet" type="text/css" href="/css/skeleton.css?v=1">
<?php if (ENV === 'prod'): ?>
<link rel="stylesheet" type="text/css" href="/css/custom.css?v=1">
<?php endif ?>
</head>
<body>
<?php if (ENV === 'dev'): ?>
<style>
<?php echo file_get_contents('/var/www/html/css/custom.css') ?>
</style>
<?php endif ?>