Skip to content

Commit 0623a2e

Browse files
committed
v2.0 Improved and expaned. Pretty links introduced.
1 parent 8090cce commit 0623a2e

File tree

5 files changed

+22
-19
lines changed

5 files changed

+22
-19
lines changed

content/contact-us.php

Lines changed: 0 additions & 2 deletions
This file was deleted.

functions.php

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -10,13 +10,12 @@
1010
'' => 'Home',
1111
'about-us' => 'About Us',
1212
'products' => 'Products',
13-
'contact' => 'Contact'
13+
'contact' => 'Contact',
1414
],
1515
'template_path' => 'template',
1616
'content_path' => 'content',
1717
'pretty_uri' => true,
1818
'version' => 'v2.0',
19-
'debug' => true
2019
];
2120

2221
/**
@@ -42,17 +41,16 @@ function siteVersion()
4241
/**
4342
* Website navigation. Uses $config global.
4443
*/
45-
function navMenu($sep = ' | ')
44+
function navMenu($sep = ' | ')
4645
{
4746
global $config;
4847

4948
$nav_manu = '';
50-
51-
foreach($config['nav_menu'] as $uri => $name)
52-
{
53-
$nav_manu .= '<a href="/'. ($config['pretty_uri'] ? '' : '?page=') . $uri .'">'. $name .'</a>' . $sep;
49+
50+
foreach ($config['nav_menu'] as $uri => $name) {
51+
$nav_manu .= '<a href="/'.($config['pretty_uri'] || $uri == '' ? '' : '?page=').$uri.'">'.$name.'</a>'.$sep;
5452
}
55-
53+
5654
echo trim($nav_manu, ' |');
5755
}
5856

@@ -76,14 +74,15 @@ function pageTitle()
7674
function pageContent()
7775
{
7876
global $config;
79-
77+
8078
$page = isset($_GET['page']) ? $_GET['page'] : 'home';
81-
$path = getcwd().'/'. $config['content_path'] .'/'.$page.'.php';
79+
80+
$path = getcwd().'/'.$config['content_path'].'/'.$page.'.php';
8281

8382
if (file_exists($path)) {
8483
include $path;
8584
} else {
86-
include $config['content_path'] . '/404.php';
85+
include $config['content_path'].'/404.php';
8786
}
8887
}
8988

@@ -95,5 +94,5 @@ function run()
9594
{
9695
global $config;
9796

98-
include $config['template_path'] . '/template.php';
97+
include $config['template_path'].'/template.php';
9998
}

index.php

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1-
<?php require 'functions.php';
1+
<?php
2+
error_reporting(E_ALL);
3+
ini_set('display_errors', 1);
24

3-
run(); ?>
5+
require 'functions.php';
6+
7+
run(); ?>

readme.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,15 @@ I put together this project while introducing to PHP a good friend of mine. I de
55
## Variables
66

77
```php
8+
89
$variable = 'Value';
10+
911
```
1012

1113
## Functions
1214

1315
```php
14-
function funcName()
16+
function showValue()
1517
{
1618
global $variable;
1719

template/template.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@
44
<meta charset="utf-8" />
55
<title><?php pageTitle(); ?> | <?php siteName(); ?></title>
66
<style type="text/css">
7-
.wrap { max-width: 700px; margin: 50px auto; padding: 30px; text-align: center; box-shadow: 0 0 5px rgba(0,0,0,.5); }
8-
article { text-align: left; padding: 40px; }
7+
.wrap { max-width: 720px; margin: 50px auto; padding: 30px 40px; text-align: center; box-shadow: 0 4px 25px -4px #9da5ab; }
8+
article { text-align: left; padding: 40px; line-height: 150%; }
99
</style>
1010
</head>
1111
<body>

0 commit comments

Comments
 (0)