-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.php
68 lines (54 loc) · 1.92 KB
/
index.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
<?php namespace fhall\Resume; ?>
<!DOCTYPE html>
<?php
/** Require composer autoloader */
require __DIR__ . '/vendor/autoload.php';
/** URL for the Markdown transformer service */
$markdown_transformer_service_url = 'https://md-transformer.herokuapp.com/';
/** Names and URLs to the markdown resources that are to be transformed */
$markdown_resources_urls = [
'bio' => file_get_contents('content/bio.md'),
'experience' => file_get_contents('content/experience.md'),
'education' => file_get_contents('content/education.md'),
'contact' => file_get_contents('content/contact.md')
];
/** The transformed content (initially an empty array) */
$content = [];
/** Loop throught the markdown resources urls, transform the content and populate the content array */
$http_client = new \GuzzleHttp\Client(['base_uri' => $markdown_transformer_service_url]);
foreach ($markdown_resources_urls as $name => $resource) {
$http_response = $http_client->request('POST', '', ['body' => $resource]);
$content[$name] = $http_response->getBody();
}
?>
<html>
<head>
<title>fhall</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<link href="https://fonts.googleapis.com/css?family=Open+Sans|Slabo+27px" rel="stylesheet">
<link rel="stylesheet" type="text/css" href="css/style.css">
</head>
<body>
<div id="wrapper">
<header>
<h1>Resume of Fredrik Hall</h1>
</header>
<nav>
<?php foreach($content as $name => $html) : ?>
<a href="#<?php echo $name; ?>"><?php echo $name; ?></a>
<?php endforeach; ?>
</nav>
<section id="content">
<?php
/** Loop through the transformed content array and put each content resource in a separate section */
foreach ($content as $name => $html) :
?>
<section id="<?php echo $name; ?>" data-max-items="3" data-max-items-delimiter="h3">
<?php echo $html; ?>
</section>
<?php endforeach; ?>
</section>
</div>
<script type="text/javascript" src="js/resume.js"></script>
</body>
</html>