Created
June 27, 2017 13:46
-
-
Save Chriswilldo/d2fe77d987e98535fac3e4f6b049c82c to your computer and use it in GitHub Desktop.
Front end
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
<div id="console-debug"> | |
<?php | |
$all_vars = get_defined_vars(); | |
?> | |
<h1>Path Array</h1> | |
<pre><?php print_r($path); ?></pre> | |
<h1>GET</h1> | |
<pre><?php print_r($_GET); ?></pre> | |
<h1>POST</h1> | |
<pre><?php print_r($_POST); ?></pre> | |
<h1>Page Array</h1> | |
<pre><?php print_r($page); ?>/pre> | |
</div> |
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 include ('config/setup.php'); ?> | |
<!DOCTYPE html> | |
<html> | |
<head> | |
<title><?php echo $page['title'].' | '.$site_title; ?></title> | |
<meta name="viewport" content="width=device-width, initial-scale=1.0"> | |
<?php include('config/css.php'); ?> | |
<?php include('config/js.php'); ?> | |
</head> | |
<body> | |
<div id="wrap"> | |
<?php include (D_TEMPLATE.'/navigation.php'); ?> | |
<div class="container"> | |
<h1><?php echo $page['header']; ?></h1> | |
<p><?php echo $page['body_formatted']; ?></p> | |
</div> | |
</div><!-- end wrap --> | |
<?php include (D_TEMPLATE.'/footer.php') ; ?> | |
<?php if($debug == 1) { include ('widgets/debug.php'); } ?> | |
</body> | |
</html> |
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 | |
function get_path() { | |
$path = array(); | |
if (isset($_SERVER['REQUEST_URI'])); { | |
$request_path = explode('?', $_SERVER['REQUEST_URI']); | |
$path['base'] = rtrim(dirname($_SERVER['SCRIPT_NAME']), '\/'); | |
$path['call_utf8'] = substr(urldecode($request_path[0]), strlen($path['base']) + 1); | |
$path['call'] = utf8_decode($path['call_utf8']); | |
if ($path['call'] == basename($_SERVER['PHP_SELF'])) { | |
$path['call'] = ''; | |
} | |
$path['call_parts'] = explode('/', $path['call']); | |
$path['query_utf8'] = urldecode($request_path[1]); | |
$path['query'] = utf8_decode(urldecode($request_path[1])); | |
$vars = explode('&', $path['query']); | |
foreach ($vars as $var) { | |
$t = explode('=', $var); | |
$path['query_vars'][$t[0]] = $t[1]; | |
} | |
} | |
return $path; | |
} | |
?> |
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 | |
// setup file: | |
error_reporting(0); | |
#database connection | |
include ('config/connection.php'); | |
#Constants: | |
DEFINE('D_TEMPLATE', 'template'); | |
#functions: | |
include('functions/sandbox.php'); | |
include('functions/data.php'); | |
include('functions/template.php'); | |
#site setup | |
$debug = data_setting_value($dbc, 'debug-status'); | |
$path = get_path(); | |
$site_title = 'ChrisCMS'; | |
if(isset($_GET['page'])) { | |
$pageid = $_GET['page']; // Set $pageid to equal the value given in the url | |
} else { | |
$pageid = 'home'; // set $pageid equal to 1 or to the Home Page | |
} | |
$page = data_page($dbc, $pageid); | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment