-
Notifications
You must be signed in to change notification settings - Fork 14
/
functions.php
49 lines (40 loc) · 1021 Bytes
/
functions.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
<?php
function has_content($key) {
global $content;
return isset($content[$key]);
}
function yield($key = 'default', $echo = true) {
global $content;
$out = has_content($key) ? $content[$key] : '';
if ($echo) {
echo $out;
} else {
return $out;
}
}
function javascripts() {
global $content;
if (!isset($content['javascripts'])) $content['javascripts'] = '';
$args = func_get_args();
foreach($args as $script) {
if (substr($script, 0, 7) != 'http://') {
$script = "js/$script.js";
}
$content['javascripts'] .= '<script src="'.$script.'"></script>';
}
}
function stylesheets() {
global $content;
if (!isset($content['stylesheets'])) $content['stylesheets'] = '';
$args = func_get_args();
foreach($args as $style) {
if (substr($style, 0, 7) != 'http://') {
$style = "css/$style.css";
}
$content['stylesheets'] .= '<link rel="stylesheet" href="'.$style.'">';
}
}
function title($title) {
global $content;
$content['title'] = $title;
}