24 lines
602 B
PHP
24 lines
602 B
PHP
|
<?php
|
||
|
|
||
|
class Template {
|
||
|
// Generates a dynamic URL to the given path.
|
||
|
private function urlFor($path): string
|
||
|
{
|
||
|
// TODO: Make this WORK!!
|
||
|
$url = dirname(dirname(str_replace(realpath($_SERVER['DOCUMENT_ROOT']), '', realpath(__DIR__))));
|
||
|
if ((strlen($url) > 1)) {
|
||
|
$url = htmlspecialchars($url . '/');
|
||
|
}
|
||
|
|
||
|
|
||
|
//FUUUUUCKKK
|
||
|
echo($_SERVER['DOCUMENT_ROOT'] . ' ' . __DIR__);
|
||
|
die();
|
||
|
return($url.$path);
|
||
|
}
|
||
|
|
||
|
public function render($name): void
|
||
|
{
|
||
|
require(__DIR__ . '/../template/' . $name . '.php');
|
||
|
}
|
||
|
}
|