Update
Took 33 minutes
This commit is contained in:
+27
@@ -0,0 +1,27 @@
|
||||
<?php
|
||||
require "vendor/blog-engine/php/Dictionary.php";
|
||||
$dictionary = new \BlogEngine\Dictionary();
|
||||
|
||||
$src = __DIR__ . "/src/";
|
||||
$html = scandir($src . "views");
|
||||
$css = scandir($src . "css");
|
||||
$js = scandir($src . "js");
|
||||
|
||||
for($i = 2; $i < count($html); $i++){
|
||||
$site = file_get_contents($src . "views/" . $html[$i]);
|
||||
foreach (array_keys($dictionary->page_tags) as $page_tag){
|
||||
if($page_tag = "{CSS}"){
|
||||
for($j = 2; $j < count($css); $j++)
|
||||
$dictionary->page_tags[$page_tag] .= "<link rel='stylesheet' href='public/css/{$css[$j]}' />";
|
||||
}
|
||||
|
||||
if($page_tag = "{JS}"){
|
||||
for($j = 2; $j < count($js); $j++)
|
||||
$dictionary->page_tags[$page_tag] .= "<script src='public/js/{$js[$j]}'></script>";
|
||||
}
|
||||
|
||||
$site = str_replace($page_tag, $dictionary->page_tags[$page_tag], $site);
|
||||
}
|
||||
|
||||
echo $site;
|
||||
}
|
||||
@@ -3,6 +3,8 @@
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<title>Witaj świecie! - {TITLE}</title>
|
||||
{CSS}
|
||||
{JS}
|
||||
<meta name="author" content="{AUTHOR}">
|
||||
</head>
|
||||
<body>
|
||||
|
||||
+8
-6
@@ -2,12 +2,14 @@
|
||||
namespace BlogEngine {
|
||||
class Dictionary {
|
||||
public $page_tags = [
|
||||
"posts" => "{POSTS}",
|
||||
"links" => "{LINKS}",
|
||||
"tags" => "{TAGS}",
|
||||
"title" => "{TITLE}",
|
||||
"author" => "{AUTHOR}",
|
||||
"description" => "{DESCRIPTION}"
|
||||
"{POSTS}" => "",
|
||||
"{LINKS}" => "",
|
||||
"{TAGS}" => "",
|
||||
"{TITLE}" => "Tytuł",
|
||||
"{AUTHOR}" => "lorem",
|
||||
"{DESCRIPTION}" => "",
|
||||
"{JS}" => "",
|
||||
"{CSS}" => ""
|
||||
];
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user