fix dir var

This commit is contained in:
Ben Harris 2017-10-03 08:41:23 -04:00
parent 2d9143a234
commit a5443d661f
4 changed files with 15 additions and 13 deletions

View File

@ -4,7 +4,7 @@
<footer class="footer">
<div class="container">
<p class="text-muted"><a href="<?=$dir?>">CS326 Pattern Book</a> - <a href="//benharris.ch">Ben Harris</a></p>
<p class="text-muted"><a href="<?=$dir?>">CS326 Pattern Book</a> - <a href="https://tilde.team/~ben/">Ben Harris</a></p>
</div>
</footer>
@ -21,4 +21,4 @@
</script>
</body>
</html>
</html>

View File

@ -1,8 +1,8 @@
<?php
include "common_fns.php";
$dir = "/";
$menu = array(
"Creational" => array(
$dir = $dir ?? implode(explode("index.php", $_SERVER["SCRIPT_NAME"]));
$menu = $menu ?? [
"Creational" => [
"Factory" => "$dir?factory",
"Double Dispatch" => "$dir?doubledispatch",
"Prototype" => "$dir?prototype",
@ -11,8 +11,8 @@ $menu = array(
"Builder" => "$dir?builder",
"Singleton" => "$dir?singleton",
"Null Object" => "$dir?nullobject"
),
"Behavioral" => array(
],
"Behavioral" => [
"Command" => "$dir?command",
"Observer" => "$dir?observer",
"Mediator" => "$dir?mediator",
@ -24,8 +24,8 @@ $menu = array(
"Template Method" => "$dir?template",
"State" => "$dir?state",
"Strategy" => "$dir?strategy"
),
"Structural" => array(
],
"Structural" => [
"Facade" => "$dir?facade",
"Composite" => "$dir?composite",
"Decorator" => "$dir?decorator",
@ -34,8 +34,8 @@ $menu = array(
"Adapter" => "$dir?adapter",
"Flyweight" => "$dir?flyweight",
"Proxy" => "$dir?proxy"
)
);
]
];
?>

View File

@ -28,7 +28,7 @@ include_once "header.php";
<h3>Ben Harris' Pattern Book</h3>
</div>
<p>This is collection of experiences I have noticed in my experiences with software development so far.</p>
<p>This is a collection of experiences I have noticed in my experiences with software development so far.</p>
<p>Patterns are:</p>
<ul>
<li>element of grammar</li>
@ -48,3 +48,4 @@ include_once "header.php";
<div class="page-header"><h2><strong>Allow, don't force.</strong></h2></div>
<?php include_once "footer.php";

View File

@ -1,5 +1,6 @@
<?php
if(empty($pattern)){header("Location: /"); die();}
$dir = $dir ?? implode(explode("index.php", $_SERVER["SCRIPT_NAME"]));
if(empty($pattern)){header("Location: $dir"); die();}
include_once "header.php";