mirror of
https://github.com/Aviortheking/Blog_IMIE.git
synced 2025-06-13 10:39:19 +00:00
remove files from .gitignore
added .html files edited handler and tagHandler
This commit is contained in:
1
project/assets/html/includes/footer.html
Normal file
1
project/assets/html/includes/footer.html
Normal file
@ -0,0 +1 @@
|
||||
<div>@Copyright 2018 HIFIVE</div>
|
8
project/assets/html/includes/head.html
Normal file
8
project/assets/html/includes/head.html
Normal file
@ -0,0 +1,8 @@
|
||||
<head>
|
||||
<meta charset="utf-8" />
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
|
||||
<title>Page Title</title>
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
||||
<link rel="stylesheet" type="text/css" media="screen" href="main.css" />
|
||||
<script src="main.js"></script>
|
||||
</head>
|
1
project/assets/html/includes/header.html
Normal file
1
project/assets/html/includes/header.html
Normal file
@ -0,0 +1 @@
|
||||
<nav>pouet</nav>
|
13
project/assets/html/index.html
Normal file
13
project/assets/html/index.html
Normal file
@ -0,0 +1,13 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head></head>
|
||||
<body>
|
||||
<header>
|
||||
<tag type="includes" file="header" />
|
||||
</header>
|
||||
<footer>
|
||||
<tag type="includes" file="footer" />
|
||||
</footer>
|
||||
|
||||
</body>
|
||||
</html>
|
@ -1 +1,15 @@
|
||||
/* Fichier qui va gerer la creation de la page et la redirection au cas ou */
|
||||
<?php
|
||||
/* Fichier qui va gerer la creation de la page et la redirection au cas ou */
|
||||
|
||||
|
||||
|
||||
$_GET['page'] = trim($_GET['page'], '/');
|
||||
$_GET['page'] = explode('/', $_GET['page'])[0];
|
||||
if($_GET['page'] == '') $_GET['page'] = 'index';
|
||||
|
||||
// var_dump($_POST);
|
||||
// var_dump($_GET);
|
||||
|
||||
include_once "tagHandler.php";
|
||||
$file = file_get_contents("../html/".$_GET["page"].".html");
|
||||
echo loadTags($file, false);
|
@ -137,6 +137,18 @@ class author extends tag {
|
||||
}
|
||||
}
|
||||
|
||||
class includes extends tag {
|
||||
public function render() {
|
||||
$el = $this->getDOM();
|
||||
$doc = $this->getDoc();
|
||||
$attr = $el->getAttribute("file");
|
||||
$t = $doc->createDocumentFragment();
|
||||
$p = file_get_contents("../html/includes/".$attr.".html");
|
||||
$t->appendXML($p);
|
||||
$el->parentNode->appendChild($t);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* input <tag type="loop" for="(table)" limit="(nombre-max généré)">
|
||||
@ -243,7 +255,7 @@ function renameTag( DOMElement $oldTag, $newTagName ) {
|
||||
|
||||
|
||||
//testing purpose
|
||||
$content = file_get_contents("./test.html");
|
||||
//$content = file_get_contents("./test.html");
|
||||
|
||||
|
||||
function loadTags($ctnt, $debug) {
|
||||
@ -252,7 +264,14 @@ function loadTags($ctnt, $debug) {
|
||||
$dom->loadHTML($ctnt);
|
||||
libxml_clear_errors();
|
||||
$list = $dom->getElementsByTagName("tag");
|
||||
|
||||
|
||||
|
||||
$head = $dom->getElementsByTagName("head");
|
||||
$t = $dom->createDocumentFragment();
|
||||
$p = file_get_contents("../html/includes/head.html");
|
||||
$t->appendXML($p);
|
||||
$head->item(0)->appendChild($t);
|
||||
|
||||
for ($i=0; $i < $list->count(); $i++) {
|
||||
$lst = $list->item($i);
|
||||
$tgs = $lst->getAttribute("type");
|
||||
@ -270,5 +289,3 @@ function loadTags($ctnt, $debug) {
|
||||
$res = $dom->saveHTML();
|
||||
echo $res;
|
||||
}
|
||||
|
||||
loadTags($content, $debug);
|
||||
|
Reference in New Issue
Block a user