-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.php
More file actions
92 lines (89 loc) · 3.06 KB
/
index.php
File metadata and controls
92 lines (89 loc) · 3.06 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
<?php
new Main();
class Main {
private function getRootpath(){
/*
Find the rootpath of our files
@return 'path/to/our/rootdirectory';
The path is those on the localmaschine - not the publicpath
*/
$paths = explode(DIRECTORY_SEPARATOR,__dir__);
$count = count($paths)-1;
$path='';
for($i=0;$i<$count;$i++){
if($i==0){
$path = $paths[$i];
}else{
$path = $path.'/'.$paths[$i];
}
}
$rootpath = $path;
return $rootpath;
}
public function autoloader($class){
$class = str_replace('\\', DIRECTORY_SEPARATOR, $class);
$class = str_replace('tekki\core', 'core'.DIRECTORY_SEPARATOR.'src', $class);
$file = $this->getRootpath().DIRECTORY_SEPARATOR.$class.'.php';
// echo($file);
if(file_exists($file)){
try{
require_once($file);
}
catch(Throwable $e){
echo '<h1>Game Over</h1>';
echo $e->getMessage(), "\n";
}
}else{
}
}
public function __construct(){
spl_autoload_register(array($this, 'autoloader'));
new Page();
}
}
use tekki\core\html\HTML;
use tekki\core\w3css\W3css as W3;
class Page {
public function __construct()
{
$html = new HTML();
$html->setLang('de');
$head = $html->head();
$head->meta()->setCharsetUtf8();
$head->meta()->setViewport();
$head->meta()->setAuthor('Authorname');
$head->meta()->setApplicationName('Applicationname');
$head->meta()->setDescription('This Application is for showing Texts or Images in a HTML-Format.');
$head->meta()->setKeywords('Composer PHP HTML5 Bibliothek');
$head->includeCSS('https://www.w3schools.com/w3css/4/w3.css');
$body = $html->body();
$body->setClass(W3::BLACK);
$header = $body->header();
$header->setClass(W3::BLUE_GREY);
$h1 = $header->h1();
$h1->setClass(W3::TEXT_DEEP_ORANGE);
$h1->text('Composer PHP HTML5 Bibliothek');
$div = $body->div();
$button = $div->button();
$button->setClass(W3::INPUT.W3::BLUE.W3::HOVER_AMBER);
$button->onClick('alert(\'Hello World\');')->text('Uff');
$main = $div->main();
$main->setClass(W3::DARK_GREY);
$main->text('Content');
// <h1>Verwendung des <span class="kw" translate="no">translate</span>-Attributs in HTML</h1>
$h1 = $main->h1();
$h1->span()->text('Ich bin ein Titeltext ');
$h1->span()->text('und soll nicht ')->setTranslate('no');
$h1->span()->text('übersetzt werden.');
// <object data="pic_trulli.jpg" width="300" height="200"></object>
$object = $main->object();
$object->setData('pic_trulli.jpg');
$object->setWidth(300);
$object->setHeight(200);
$footer = $body->footer();
$footer->setClass(W3::BLUE_GREY);
$footer->text('Footer');
$html->render(true);
}
}
?>