remove files from .gitignore

added .html files
edited handler and tagHandler
This commit is contained in:
2018-11-26 14:01:19 +01:00
parent 68df6e6969
commit 49d539ee72
12 changed files with 61 additions and 262 deletions

View File

@ -0,0 +1 @@
<div>@Copyright 2018 HIFIVE</div>

View 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>

View File

@ -0,0 +1 @@
<nav>pouet</nav>

View 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>

View File

@ -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);

View File

@ -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);