-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcontents.php
More file actions
33 lines (28 loc) · 794 Bytes
/
Copy pathcontents.php
File metadata and controls
33 lines (28 loc) · 794 Bytes
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
<?php
require_once "config.php";
function getHeader($name) {
// heredoc http://php.net/manual/ro/language.types.string.php
$title = SITE_TITLE;
return <<<HTML
<div id="header">
<h1><a href="index.php">$title</a></h1>
<br/>
<h2>$name</h2>
</div>
HTML;
}
function getNav($selectedIndex = 0)
{
global $links;
$content = [];
for( $i = 0; $i < count($links); $i++) {
$link = $links[$i];
if( $i + 1 == $selectedIndex ) {
$content[] = "<a href=\"" . $link["href"] . "\" class=\"selected\">" . $link["label"] . "</a> |";
}
else {
$content[] = sprintf("<a href=\"%s\">%s</a> |", $link["href"] , $link["label"]);
}
}
return sprintf("<div id=\"nav\">\n%s</div>\n", implode("\n", $content));
}