PHP code example of user-meta / html
1. Go to this page and download the library: Download user-meta/html library . Choose the download type require .
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
user-meta / html example snippets
serMeta\Html\Html;
echo Html::text('example');
echo Html::button('Submit Me');
echo Html::email('example email');
echo Html::div('example text');
echo Html::p('example text');
echo Html::text('Example_Value', ['name' => 'Example_Name', 'id' => 'Example_ID', 'class' => 'Example_Class']);
echo Html::text('Example_Value', ['name' => 'Example_Name', 'data-example' => 'Example_Data']);
echo Html::email(null, ['name' => 'Email', ''readonly']);
echo Html::email(null, ['name' => 'Email', 'disabled']);
echo Html::email(null, [
'name' => 'Example_Name',
'label' => 'Email'
]);
echo Html::email(null, [
'name' => 'Example_Name',
'label' => [
'Example',
'class' => 'Class'
]
]);
echo Html::div('example text', ['id' => 'Example_ID', 'class' => 'Example_Class']);
echo Html::label('Some text', ['id' => 'ID', 'class' => 'Class', 'for' => 'For']);
echo Html::checkbox(true, ['name' => 'Name']);
echo Html::checkbox(true, ['name' => 'Name', 'value' => 'Value']);
echo Html::checkbox('cat', ['name' => 'Name', 'id' => 'ID'], ['dog' => 'Dog', 'cat' => 'Cat']);
echo Html::checkbox(['cat'], ['name' => 'Name', 'id' => 'ID'], ['dog' => 'Dog', 'cat' => 'Cat']);
echo Html::checkbox(['cat'], ['name' => 'Name[]', 'id' => 'ID'], ['dog' => 'Dog', 'cat' => 'Cat']);
echo Html::select(['cat'], ['name' => 'Name'], ['dog' => 'Dog', 'cat' => 'Cat']);
echo Html::select(['cat'], ['name' => 'Name'], ['dog', 'cat']);
echo Html::radio(['cat'], ['name' => 'Name', 'id' => 'ID'], ['dog', 'cat']);
$div = new Html('div');
$div->p('Hello World');
$div->text('example');
$div->add('Some plain text');
echo $div->render();
$form = new Html('form', ['method' => 'POST']);
$form->div('Enter your email and password for login');
$form->email('', ['name' => 'email', 'label' => 'Email']);
$form->password('', ['name' => 'password', 'label' => 'Password']);
$form->submit('login');
echo $form->render();
$html = new Html('html');
$head = $html->import('head');
$head->title('Example Title');
$body = $html->import('body');
$body->p('Hello World');
echo $html->render();
$book = new Html('book');
$book->title('The Da Vinci Code');
$author = $book->import('author');
$author->name('Dan Brown');
$author->nationality('American');
echo $book->render();
echo Html::email('[email protected] ');
echo Html::h1('Example Heading');
echo Html::input('email', '[email protected] ');
echo Html::tag('h1', 'Example Heading');
echo Html::email('', ['_before' => 'Before', '_after' => 'After']);
echo Html::email('', ['_enclose' => 'div']);
echo Html::email('', ['_enclose' => ['div', 'class' => 'Class']]);
// Same value and label
echo Html::select(null, [], ['audi', 'bmw']);
// Different value and label
echo Html::select(null, [], ['audi' => 'Audi', 'bmw' => 'BMW']);
// Option with extra attributes
echo Html::select(null, [], ['ferrari' => ['Ferrari', 'data-origin' => 'Italy']]);
echo Html::select(null, [], [['value' => 'ferrari', 'label' => 'Ferrari', 'data-origin' => 'Italy']]);
echo Html::select(null, [], [
'audi',
'bmw' => 'BMW',
'honda' => [
'Honda',
'data-origin' => 'Japan'
],
[
'value' => 'ferrari',
'label' => 'Ferrari',
'data-origin' => 'Italy'
]
]);
echo Html::select(null, [], [2 => 'Two', 4 => 'Four']);