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>
|
<head>
|
||||||
<meta charset="UTF-8">
|
<meta charset="UTF-8">
|
||||||
<title>Witaj świecie! - {TITLE}</title>
|
<title>Witaj świecie! - {TITLE}</title>
|
||||||
|
{CSS}
|
||||||
|
{JS}
|
||||||
<meta name="author" content="{AUTHOR}">
|
<meta name="author" content="{AUTHOR}">
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
|
|||||||
+8
-6
@@ -2,12 +2,14 @@
|
|||||||
namespace BlogEngine {
|
namespace BlogEngine {
|
||||||
class Dictionary {
|
class Dictionary {
|
||||||
public $page_tags = [
|
public $page_tags = [
|
||||||
"posts" => "{POSTS}",
|
"{POSTS}" => "",
|
||||||
"links" => "{LINKS}",
|
"{LINKS}" => "",
|
||||||
"tags" => "{TAGS}",
|
"{TAGS}" => "",
|
||||||
"title" => "{TITLE}",
|
"{TITLE}" => "Tytuł",
|
||||||
"author" => "{AUTHOR}",
|
"{AUTHOR}" => "lorem",
|
||||||
"description" => "{DESCRIPTION}"
|
"{DESCRIPTION}" => "",
|
||||||
|
"{JS}" => "",
|
||||||
|
"{CSS}" => ""
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user