Skip to content

Instantly share code, notes, and snippets.

@fabwu
Created November 28, 2013 17:48
Show Gist options
  • Save fabwu/7695817 to your computer and use it in GitHub Desktop.
Save fabwu/7695817 to your computer and use it in GitHub Desktop.
index.php
<?php
$titles = array('main' => 'Startseite', 'canvas' => 'Canvas', 'formular' => 'Formular', );
$urlParts = array();
preg_match('/\/([a-z]+)\.php(\?.*)?$/', $_SERVER["REQUEST_URI"], $urlParts);
if (isset($urlParts[1]) && isset($titles[$urlParts[1]])) {
$page = $urlParts[1];
} else {
$page = 'main';
}
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="description" content="">
<meta name="author" content="Fabian Wüthrich">
<link rel="shortcut icon" href="#">
<title><?php echo $titles[$page]; ?>-
Carrosserie Wüthrich Tecknau</title>
<!-- Cookie auslesen für Style-Switch -->
<?php
// Checks for, and assigns cookie to local variable:
if ($_COOKIE['style'] == 'bootstrap.min' or $_COOKIE['style'] == 'bootstrap.min.second')
$style = $_COOKIE['style'];
// If no cookie is present then set style as "day" (default):
else
$style = 'bootstrap.min';
?>
<!-- Bootstrap core CSS -->
<link href="css/<?php echo htmlspecialchars($style) ?>.css" rel="stylesheet">
<!-- Custom styles for this template -->
<link href="css/red.css" rel="stylesheet">
<!-- HTML5 shim and Respond.js IE8 support of HTML5 elements and media queries -->
<!--[if lt IE 9]>
<script src="https://oss.maxcdn.com/libs/html5shiv/3.7.0/html5shiv.js"></script>
<script src="https://oss.maxcdn.com/libs/respond.js/1.3.0/respond.min.js"></script>
<![endif]-->
<style type="text/css"></style>
<!-- Bootstrap core JavaScript
================================================== -->
<script src="js/jquery-1.10.2.min.js"></script>
<script src="js/bootstrap.min.js"></script>
<script src="js/script.js"></script>
<script>
$(document).ready(function() {
$('.styleswitch a').removeAttr("href");
styleSwitcher();
});
</script>
</head>
<body>
<!-- Navigationsbereich -->
<nav class="navbar navbar-default" role="navigation">
<!-- Brand and toggle get grouped for better mobile display -->
<div class="container">
<a href="php/style-switcher.php?style=bootstrap.min&amp;page=<?php echo htmlspecialchars($page); ?>" class="pull-right styleswitch" id="dark"></a>
<a href="php/style-switcher.php?style=bootstrap.min.second&amp;page=<?php echo htmlspecialchars($page); ?>" class="pull-right styleswitch" id="red"></a>
<div class="navbar-header col-sm-3 col-lg-2">
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target="#navbar-position">
<span class="sr-only">Toggle navigation</span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<a class="navbar-brand" href="#">Carrosserie Wüthrich Tecknau</a>
</div>
<!-- Collect the nav links, forms, and other content for toggling -->
<div class="navbar-with-border col-sm-9 col-lg-10">
<div class="collapse navbar-collapse" id="navbar-position">
<ul class="nav navbar-nav">
<?php
foreach ($titles as $key => $title) {
echo '<li><a href="' . $key . '.php" class="onPage" id="' . $key . '">' . $title . '</a></li>';
}
?>
</ul>
</div>
</div>
</div>
</nav>
<div id="swapper">
<?php
include ('pages/' . $page . '.php');
?>
</div>
<!-- Site footer -->
<footer class="container">
<p>
Copyrigth 2013
</p>
</footer>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment