Added initial example site, containing hello-world module.
This commit is contained in:
parent
9304b986f4
commit
a84610bc84
6 changed files with 56 additions and 0 deletions
9
bin/index.php
Normal file
9
bin/index.php
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
<?php
|
||||
|
||||
$root = realpath(implode(DIRECTORY_SEPARATOR, [__DIR__, "..", "..", ".."]));
|
||||
|
||||
include implode(DIRECTORY_SEPARATOR, [$root, "vendor", "autoload.php"]);
|
||||
|
||||
use \Lewp\Site;
|
||||
|
||||
new Site("localhost", "home", $root);
|
||||
3
css/site.css
Normal file
3
css/site.css
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
* {
|
||||
box-sizing: border-box;
|
||||
}
|
||||
29
modules/header-description/module.php
Normal file
29
modules/header-description/module.php
Normal file
|
|
@ -0,0 +1,29 @@
|
|||
<?php
|
||||
|
||||
return new class extends \Lewp\Module {
|
||||
|
||||
private function header()
|
||||
{
|
||||
return $this->createElement("h1", "Hello World!");
|
||||
}
|
||||
|
||||
private function description()
|
||||
{
|
||||
return $this->createElement(
|
||||
"p",
|
||||
$this->loadTextFile("en_description")
|
||||
);
|
||||
}
|
||||
|
||||
public function run(array $options = []) : bool
|
||||
{
|
||||
$this->appendChild($this->header());
|
||||
$this->appendChild($this->description());
|
||||
return true;
|
||||
}
|
||||
|
||||
public function onWebsocketRequest(
|
||||
\Lewp\Websocket\Message $message
|
||||
) : \Lewp\Websocket\Message {
|
||||
}
|
||||
};
|
||||
|
|
@ -0,0 +1,4 @@
|
|||
This is your starting point for another lewp module.
|
||||
|
||||
The following table shows the options that are passed to the module when it gets
|
||||
called as well as the module configuration.
|
||||
1
modules/hello-world
Submodule
1
modules/hello-world
Submodule
|
|
@ -0,0 +1 @@
|
|||
Subproject commit 04d445534f512e413623b8bb9a751a196e5264d9
|
||||
10
pages/home.php
Normal file
10
pages/home.php
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
<?php
|
||||
|
||||
return new class extends \Lewp\Page {
|
||||
public function run(array $options = []) : bool
|
||||
{
|
||||
$this->addModule("header-description");
|
||||
$this->addModule("hello-world", $options);
|
||||
return true;
|
||||
}
|
||||
};
|
||||
Loading…
Add table
Add a link
Reference in a new issue