<?php\r
$parts = $_SERVER['DOCUMENT_ROOT'] . '/parts';\r
+ require_once($parts . '/head.php');\r
+ $pgtitle = "bochard's net home";\r
+ $pgdescription = "Welcome to my net home! this website are my space to show my hobbies, thoughts, and other fun stuffs. I am an 18 years old who learned how to code just by myself. Hope you enjoy visiting my site! :)";\r
+ head($pgtitle, $pgdescription);\r
?>\r
-<!DOCTYPE html>\r
-<html lang="en">\r
-<head>\r
- <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">\r
- <meta name="robots" content="index, follow">\r
- <link rel="shortcut icon" href="/images/icons/favicon.ico">\r
-\r
- <title>bochard's net home</title>\r
- <meta name="description" content="Welcome to my net home! this website are my space to show my hobbies, thoughts, and other fun stuffs. I am an 18 years old who learned how to code just by myself. Hope you enjoy visiting my site! :)">\r
-\r
- <!-- stylesheet/s i use -->\r
- <link rel="stylesheet" href="/stylesheets/root.css">\r
-</head>\r
<body> \r
<table>\r
<tr>\r
--- /dev/null
+<?php
+function head($pgtitle, $pgdescription, $pgcss = []){ ?>
+ <!DOCTYPE html>
+ <html lang="en">
+ <head>
+ <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+ <meta name="robots" content="index, follow">
+ <link rel="shortcut icon" href="/images/icons/favicon.ico">
+
+ <title><?= htmlspecialchars($pgtitle, ENT_COMPAT); ?></title>
+ <meta name="description" content="<?= htmlspecialchars($pgdescription, ENT_COMPAT); ?>">
+
+ <!-- stylesheet/s i use -->
+ <link rel="stylesheet" href="/stylesheets/root.css?v=<?= filemtime($_SERVER['DOCUMENT_ROOT']. '/stylesheets/root.css'); ?>">
+ <?php foreach($pgcss as $filepath): ?>
+ <link rel="stylesheet" href="<?= htmlspecialchars($filepath) . '?v=' . filemtime($filepath); ?>">
+ <?php endforeach; ?>
+ </head>
+<?php }