-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.php
52 lines (46 loc) · 1.3 KB
/
index.php
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
<?php
require('vendor/autoload.php');
require('model.php');
use Formularium\FrameworkComposer;
use Formularium\Model;
use Formularium\Element;
// set your framework composition.
$composer = FrameworkComposer::create(['HTML', 'HTMLValidation', 'Bootstrap']);
// get your model data.
$model = modelData();
// get a button dynamically
$submitButton = $composer->element(
'Button',
[
Element::LABEL => 'Submit',
Formularium\Frontend\HTML\Element\Button::TYPE => 'submit',
Element::SIZE => Element::SIZE_LARGE,
]
);
?><!DOCTYPE html>
<html>
<head>
<meta charset='utf-8'>
<title>Formularium pure PHP</title>
<?php echo $composer->htmlHead(); ?>
</head>
<body>
<div class='container'>
<h1>Formularium pure PHP</h1>
<p>
This is a simple example of using <a href="https://github.com/Corollarium/Formularium">Formularium</a> in a framework agnostic way.
</p>
<form method="POST" action="/post.php">
<?php // render a form
echo $model->editable($composer);
echo $submitButton;
?>
</form>
<footer style="text-align: center; margin-top: 2em;">
<small>
See <a href="https://github.com/Corollarium/Formularium">Formularium on GitHub</a>
</small>
<?php echo $composer->htmlFooter(); ?>
</footer>
</div>
</html>