diff --git a/public/html_loader.php b/public/html_loader.php
index 5251469..cc8c834 100755
--- a/public/html_loader.php
+++ b/public/html_loader.php
@@ -51,7 +51,7 @@ class HTMLLoader {
die($replace);
}
- function show() {
+ function show($args = []) {
$template = $this->template;
$file = file_get_contents(TEMPLATE_CONF);
@@ -75,6 +75,11 @@ class HTMLLoader {
$html = str_replace("%css%", $css, $html);
+ // Insert Args
+ foreach ($args as $key => $value) {
+ $html = str_replace($key, $value, $html);
+ }
+
die($html);
}
}
\ No newline at end of file
diff --git a/public/index.php b/public/index.php
index 830fe42..c930b11 100755
--- a/public/index.php
+++ b/public/index.php
@@ -8,3 +8,30 @@ require "main.php";
// Init GB Class
$gb = new gb(true);
+// Load HTMLLoader Library
+require FRONTEND_PATH . "html_loader.php";
+$htmlLoader = new HTMLLoader();
+
+// Build Entry Page
+$htmlLoader->setTemplate("entrys_frontend");
+
+$url = "http://" . APP_DOMAIN . "/api/entrys/get.php";
+$response = file_get_contents($url);
+
+$entrys = json_decode($response, true);
+$entrys = $entrys["entrys"];
+
+$html_block = "";
+foreach($entrys as $entry) {
+ $name = $entry["name"];
+ $text = $entry["text"];
+
+ $html_block .= '
+
+
' . $name . '
+
' . $text . '
+
+ ';
+}
+
+$htmlLoader->show(["%entrys%" => $html_block]);
\ No newline at end of file
diff --git a/public/main.php b/public/main.php
index 117fca4..40fe680 100755
--- a/public/main.php
+++ b/public/main.php
@@ -10,7 +10,7 @@ class gb {
// Define Paths
define("APP_DOMAIN", $_SERVER["SERVER_NAME"]);
- define("APP_PATH", __DIR__ . "/..");
+ define("APP_PATH", __DIR__ . "/../");
define("FRONTEND_PATH", __DIR__ . "/");
define("TEMPLATE_PATH", FRONTEND_PATH . "templates/");
define("TEMPLATE_CONF", TEMPLATE_PATH . "templates.json");
diff --git a/public/templates/entrys_frontend/entrys.html b/public/templates/entrys_frontend/entrys.html
deleted file mode 100755
index e69de29..0000000
diff --git a/public/templates/entrys_frontend/entrys_frontend.html b/public/templates/entrys_frontend/entrys_frontend.html
new file mode 100755
index 0000000..33a3c6c
--- /dev/null
+++ b/public/templates/entrys_frontend/entrys_frontend.html
@@ -0,0 +1,35 @@
+
+
+
+
+
+
+
+ %appname% // Entrys
+
+
+
+
+ %appname%
+ All Entrys
+
+
\ No newline at end of file
diff --git a/public/templates/setup/setup.css b/public/templates/setup/setup.css
deleted file mode 100755
index e69de29..0000000
diff --git a/public/templates/templates.json b/public/templates/templates.json
index 896a77b..b23bcc2 100755
--- a/public/templates/templates.json
+++ b/public/templates/templates.json
@@ -11,8 +11,12 @@
"name":"setup",
"dir_name":"setup",
"html_file":"setup.html",
- "css_files":[
- "setup.css"
- ]
+ "css_files":[]
+ },
+ "entrys_frontend":{
+ "name":"entrys_frontend",
+ "dir_name":"entrys_frontend",
+ "html_file":"entrys_frontend.html",
+ "css_files":[]
}
}
\ No newline at end of file
diff --git a/public/test.php b/public/test.php
index d3ba69f..74c5f6e 100755
--- a/public/test.php
+++ b/public/test.php
@@ -13,4 +13,6 @@
//echo "Decode: " . hash_equals($string, $secret);
-print_r(PDO::getAvailableDrivers());
+//print_r(PDO::getAvailableDrivers());
+
+print_r(json_decode('{"entrys":[{"name":"marc"}]}', true));
\ No newline at end of file