-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
17 changed files
with
273 additions
and
30 deletions.
There are no files selected for viewing
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
<p>404 - This page does not exist.</p> |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
<p>This is <b>about</b> page. Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.</p> | ||
</p>It is a long established fact that a reader will be distracted by the readable content of a page when looking at its layout. The point of using Lorem Ipsum is that it has a more-or-less normal distribution of letters, as opposed to using 'Content here, content here', making it look like readable English. Many desktop publishing packages and web page editors now use Lorem Ipsum as their default model text, and a search for 'lorem ipsum' will uncover many web sites still in their infancy. Various versions have evolved over the years, sometimes by accident, sometimes on purpose (injected humour and the like).</p> |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
<p>This is <b>contact</b> page. Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.</p> | ||
</p>It is a long established fact that a reader will be distracted by the readable content of a page when looking at its layout. The point of using Lorem Ipsum is that it has a more-or-less normal distribution of letters, as opposed to using 'Content here, content here', making it look like readable English. Many desktop publishing packages and web page editors now use Lorem Ipsum as their default model text, and a search for 'lorem ipsum' will uncover many web sites still in their infancy. Various versions have evolved over the years, sometimes by accident, sometimes on purpose (injected humour and the like).</p> |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
<p>This is <b>home</b> page.Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.</p> | ||
</p>It is a long established fact that a reader will be distracted by the readable content of a page when looking at its layout. The point of using Lorem Ipsum is that it has a more-or-less normal distribution of letters, as opposed to using 'Content here, content here', making it look like readable English. Many desktop publishing packages and web page editors now use Lorem Ipsum as their default model text, and a search for 'lorem ipsum' will uncover many web sites still in their infancy. Various versions have evolved over the years, sometimes by accident, sometimes on purpose (injected humour and the like).</p> |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
<p>This is <b>product</b> page. Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.</p> | ||
</p>It is a long established fact that a reader will be distracted by the readable content of a page when looking at its layout. The point of using Lorem Ipsum is that it has a more-or-less normal distribution of letters, as opposed to using 'Content here, content here', making it look like readable English. Many desktop publishing packages and web page editors now use Lorem Ipsum as their default model text, and a search for 'lorem ipsum' will uncover many web sites still in their infancy. Various versions have evolved over the years, sometimes by accident, sometimes on purpose (injected humour and the like).</p> |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
<?php | ||
|
||
/** | ||
* Used to store website configuration information. | ||
* | ||
* @var string or null | ||
*/ | ||
function config($key = '') | ||
{ | ||
$config = [ | ||
'name' => 'Simple PHP Website', | ||
'site_url' => '', | ||
'pretty_uri' => false, | ||
'nav_menu' => [ | ||
'' => 'Home', | ||
'about-us' => 'About Us', | ||
'products' => 'Products', | ||
'contact' => 'Contact', | ||
], | ||
'template_path' => 'template', | ||
'content_path' => 'content', | ||
'version' => 'v3.0', | ||
]; | ||
|
||
return isset($config[$key]) ? $config[$key] : null; | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,80 @@ | ||
<?php | ||
|
||
/** | ||
* Displays site name. | ||
*/ | ||
function site_name() | ||
{ | ||
echo config('name'); | ||
} | ||
|
||
/** | ||
* Displays site url provided in conig. | ||
*/ | ||
function site_url() | ||
{ | ||
echo config('site_url'); | ||
} | ||
|
||
/** | ||
* Displays site version. | ||
*/ | ||
function site_version() | ||
{ | ||
echo config('version'); | ||
} | ||
|
||
/** | ||
* Website navigation. | ||
*/ | ||
function nav_menu($sep = ' | ') | ||
{ | ||
$nav_menu = ''; | ||
$nav_items = config('nav_menu'); | ||
foreach ($nav_items as $uri => $name) { | ||
$class = str_replace('page=', '', $_SERVER['QUERY_STRING']) == $uri ? ' active' : ''; | ||
$url = config('site_url') . '/' . (config('pretty_uri') || $uri == '' ? '' : '?page=') . $uri; | ||
|
||
$nav_menu .= '<a href="' . $url . '" title="' . $name . '" class="item ' . $class . '">' . $name . '</a>' . $sep; | ||
} | ||
|
||
echo trim($nav_menu, $sep); | ||
} | ||
|
||
/** | ||
* Displays page title. It takes the data from | ||
* URL, it replaces the hyphens with spaces and | ||
* it capitalizes the words. | ||
*/ | ||
function page_title() | ||
{ | ||
$page = isset($_GET['page']) ? htmlspecialchars($_GET['page']) : 'Home'; | ||
|
||
echo ucwords(str_replace('-', ' ', $page)); | ||
} | ||
|
||
/** | ||
* Displays page content. It takes the data from | ||
* the static pages inside the pages/ directory. | ||
* When not found, display the 404 error page. | ||
*/ | ||
function page_content() | ||
{ | ||
$page = isset($_GET['page']) ? $_GET['page'] : 'home'; | ||
|
||
$path = getcwd() . '/' . config('content_path') . '/' . $page . '.phtml'; | ||
|
||
if (! file_exists($path)) { | ||
$path = getcwd() . '/' . config('content_path') . '/404.phtml'; | ||
} | ||
|
||
echo file_get_contents($path); | ||
} | ||
|
||
/** | ||
* Starts everything and displays the template. | ||
*/ | ||
function init() | ||
{ | ||
require config('template_path') . '/template.php'; | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,10 @@ | ||
<?php | ||
if (true) { echo 'hello'; } | ||
?> | ||
<h1>lol</h1> | ||
|
||
// Comment these lines to hide errors | ||
error_reporting(E_ALL); | ||
ini_set('display_errors', 1); | ||
|
||
require 'includes/config.php'; | ||
require 'includes/functions.php'; | ||
|
||
init(); |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
/.idea | ||
.php_cs.cache |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
Options +FollowSymLinks | ||
RewriteEngine On | ||
|
||
RewriteCond %{REQUEST_FILENAME} !-d | ||
RewriteCond %{REQUEST_FILENAME} !-f | ||
RewriteRule ^(.*)$ index.php?page=$1 [L] |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
|
||
.wrap { | ||
max-width: 720px; | ||
margin: 50px auto; | ||
padding: 30px 40px; | ||
text-align: center; | ||
box-shadow: 0 4px 25px -4px #9da5ab; | ||
} | ||
article { | ||
padding: 40px; | ||
line-height: 150%; | ||
text-align: left; | ||
} | ||
|
||
nav .item { | ||
text-decoration: none; | ||
} | ||
nav .active { | ||
border-bottom: 1px solid; | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
<!DOCTYPE html> | ||
<html> | ||
<head> | ||
<meta charset="utf-8" /> | ||
<title><?php page_title(); ?> | <?php site_name(); ?></title> | ||
<link href="<?php site_url(); ?>/template/style.css" rel="stylesheet" type="text/css" /> | ||
</head> | ||
<body> | ||
<div class="wrap"> | ||
|
||
<header> | ||
<h1><?php site_name(); ?></h1> | ||
<nav class="menu"> | ||
<?php nav_menu(); ?> | ||
</nav> | ||
</header> | ||
|
||
<article> | ||
<h2><?php page_title(); ?></h2> | ||
<?php page_content(); ?> | ||
</article> | ||
|
||
<footer> | ||
<small>©<?php echo date('Y'); ?> <?php site_name(); ?>.<br><?php site_version(); ?></small> | ||
</footer> | ||
|
||
</div> | ||
</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
Oops, something went wrong.