173 lines
8.5 KiB
PHP
173 lines
8.5 KiB
PHP
|
<?php
|
||
|
$sections = [
|
||
|
1 => 'Home',
|
||
|
2 => 'About myself',
|
||
|
3 => 'What I\'ve done so far',
|
||
|
4 => 'Who I would like to be',
|
||
|
5 => 'Contact me via webform'
|
||
|
];
|
||
|
if ( ! isset ( $_POST ['section'] ) || ! in_array ( $_POST ['section'], array_keys( $sections ) ) ) {
|
||
|
$section_title = 'Home';
|
||
|
}
|
||
|
else {
|
||
|
$section = $_POST ['section'];
|
||
|
$section_title = $sections [ $section ];
|
||
|
$sections_content = [
|
||
|
1 =>
|
||
|
'<header class="masthead" style="background-image: url(\'img/bg-1.jpg\')">
|
||
|
<div class="overlay"></div>
|
||
|
<div class="container">
|
||
|
<div class="row">
|
||
|
<div class="col-lg-9 col-md-10 mx-auto">
|
||
|
<div class="site-heading">
|
||
|
<h1>Bryan Joshua Pedini</h1>
|
||
|
<span class="subheading">An eighteen years old guy from Italy, with just some great ideas</span>
|
||
|
</div>
|
||
|
</div>
|
||
|
</div>
|
||
|
</div>
|
||
|
</header>
|
||
|
<footer>
|
||
|
<div class="container">
|
||
|
<div class="row">
|
||
|
<div class="col-lg-8 col-md-10 mx-auto">
|
||
|
<ul class="list-inline text-center">
|
||
|
<li class="list-inline-item">
|
||
|
<a href="#">
|
||
|
<span class="fa-stack fa-lg">
|
||
|
<i class="fas fa-circle fa-stack-2x"></i>
|
||
|
<i class="fab fa-twitter fa-stack-1x fa-inverse"></i>
|
||
|
</span>
|
||
|
</a>
|
||
|
</li>
|
||
|
<li class="list-inline-item">
|
||
|
<a href="#">
|
||
|
<span class="fa-stack fa-lg">
|
||
|
<i class="fas fa-circle fa-stack-2x"></i>
|
||
|
<i class="fab fa-facebook-f fa-stack-1x fa-inverse"></i>
|
||
|
</span>
|
||
|
</a>
|
||
|
</li>
|
||
|
<li class="list-inline-item">
|
||
|
<a href="#">
|
||
|
<span class="fa-stack fa-lg">
|
||
|
<i class="fas fa-circle fa-stack-2x"></i>
|
||
|
<i class="fab fa-github fa-stack-1x fa-inverse"></i>
|
||
|
</span>
|
||
|
</a>
|
||
|
</li>
|
||
|
</ul>
|
||
|
<p class="copyright text-muted">Copyright © Bryan Pedini <?php echo date("Y"); ?></p>
|
||
|
</div>
|
||
|
</div>
|
||
|
</div>
|
||
|
</footer>',
|
||
|
2 =>
|
||
|
'<header class="masthead" style="background-image: url(\'img/bg-2.jpg\')">
|
||
|
<div class="overlay"></div>
|
||
|
<div class="container">
|
||
|
<div class="row">
|
||
|
<div class="col-lg-8 col-md-10 mx-auto">
|
||
|
<div class="page-heading">
|
||
|
<h1>About Me</h1>
|
||
|
<span class="subheading">This is what I do.</span>
|
||
|
</div>
|
||
|
</div>
|
||
|
</div>
|
||
|
</div>
|
||
|
</header>',
|
||
|
];
|
||
|
$arr_res = [
|
||
|
'status' => 200,
|
||
|
'pageTitle' => $section_title,
|
||
|
'html' => $sections_content [ $section ]
|
||
|
];
|
||
|
$res = json_encode($arr_res);
|
||
|
header('Content-Type: application/json');
|
||
|
echo $res;
|
||
|
exit;
|
||
|
}
|
||
|
?>
|
||
|
<!DOCTYPE html>
|
||
|
<html>
|
||
|
<head>
|
||
|
<meta charset="utf-8">
|
||
|
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
|
||
|
<meta name="description" content="">
|
||
|
<meta name="author" content="">
|
||
|
<title id="page-title"><?=$section_title?> | Bryan Pedini</title>
|
||
|
<link href="vendor/bootstrap/css/bootstrap.min.css" rel="stylesheet">
|
||
|
<link href="vendor/fontawesome-free/css/all.min.css" rel="stylesheet" type="text/css">
|
||
|
<link href='https://fonts.googleapis.com/css?family=Lora:400,700,400italic,700italic' rel='stylesheet' type='text/css'>
|
||
|
<link href='https://fonts.googleapis.com/css?family=Open+Sans:300italic,400italic,600italic,700italic,800italic,400,300,600,700,800' rel='stylesheet' type='text/css'>
|
||
|
<link href="css/clean-blog.min.css" rel="stylesheet">
|
||
|
</head>
|
||
|
<body>
|
||
|
<nav class="navbar navbar-expand-lg navbar-light fixed-top" id="mainNav">
|
||
|
<div class="container">
|
||
|
<a class="navbar-brand" href="#" id="navbar-home">Bryan Pedini</a>
|
||
|
<button class="navbar-toggler navbar-toggler-right" type="button" data-toggle="collapse" data-target="#navbarResponsive" aria-controls="navbarResponsive" aria-expanded="false" aria-label="Toggle navigation">
|
||
|
Menu <i class="fas fa-bars"></i>
|
||
|
</button>
|
||
|
<div class="collapse navbar-collapse" id="navbarResponsive">
|
||
|
<ul class="navbar-nav ml-auto">
|
||
|
<li class="nav-item dropdown">
|
||
|
<a class="nav-link dropdown-toggle" href="#" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">About me</a>
|
||
|
<div class="dropdown-menu">
|
||
|
<a href="#" class="dropdown-item" id="navbar-description">A brief description</a>
|
||
|
<a href="#" class="dropdown-item" id="navbar-work">My current projects</a>
|
||
|
<a href="#" class="dropdown-item" id="navbar-ideas">My ideas</a>
|
||
|
</div>
|
||
|
</li>
|
||
|
<li class="nav-item dropdown">
|
||
|
<a class="nav-link dropdown-toggle" href="#" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">Contact me</a>
|
||
|
<div class="dropdown-menu">
|
||
|
<a href="#" class="dropdown-item" id="navbar-contact-form">Web form</a>
|
||
|
<a href="#" class="dropdown-item" id="navbar-contact-email">Email</a>
|
||
|
</div>
|
||
|
</li>
|
||
|
</ul>
|
||
|
</div>
|
||
|
</div>
|
||
|
</nav>
|
||
|
<div id="user-content">
|
||
|
</div>
|
||
|
<script src="vendor/jquery/jquery.min.js"></script>
|
||
|
<script src="vendor/bootstrap/js/bootstrap.bundle.min.js"></script>
|
||
|
<script src="js/clean-blog.min.js"></script>
|
||
|
<script>
|
||
|
var $ = jQuery;
|
||
|
function setOnClick (section) {
|
||
|
$.ajax({
|
||
|
url: 'index.php',
|
||
|
method: 'POST',
|
||
|
datatype: 'JSON',
|
||
|
data: {
|
||
|
section: section,
|
||
|
},
|
||
|
success: function (data) {
|
||
|
if ( data.status == 200 ) {
|
||
|
$('#page-title').html(data.pageTitle + " | Bryan Pedini");
|
||
|
$('#user-content').html(data.html);
|
||
|
}
|
||
|
else {
|
||
|
console.log(data.status + ": " + data.errorText);
|
||
|
}
|
||
|
},
|
||
|
error: function (jqXHR, exception) {
|
||
|
console.log(jqXHR.status + ": " + jqXHR.responseText + " | - | " + exception);
|
||
|
},
|
||
|
});
|
||
|
}
|
||
|
$('#navbar-home').on('click', function (clickEvent) { setOnClick(1) } );
|
||
|
$('#navbar-description').on('click', function (clickEvent) { setOnClick(2) });
|
||
|
$('#navbar-work').on('click', function (clickEvent) { setOnClick(3) });
|
||
|
$('#navbar-ideas').on('click', function (clickEvent) { setOnClick(4) });
|
||
|
$('#navbar-contact-form').on('click', function (clickEvent) { setOnClick(5) });
|
||
|
$('#navbar-contact-email').on('click', function (clickEvent) { window.location.href = "mailto:bryanpedini@bryanpedini.it"; });
|
||
|
$(function() {
|
||
|
setOnClick(1);
|
||
|
});
|
||
|
</script>
|
||
|
</body>
|
||
|
</html>
|