1. Go to this page and download the library: Download flsouto/htwidget 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/ */
flsouto / htwidget example snippets
class TextField extends HtWidget{
function __construct($name){
parent::__construct($name);
// By default all HtWidget instances have a default, random id.
// We want to change that so the id is always the name of the field itself.
$this->attrs['id'] = $name;
}
// All concrete HtWidget implementations must define a renderWritable method
function renderWritable(){
$attrs = $this->attrs;
$attrs['value'] = $this->value();
echo '<input '.$attrs.' />';
}
// All concrete HtWidget implementations must define a renderReadonly method
function renderReadonly(){
$attrs = $this->attrs;
echo "<span ".$attrs.">".$this->value()."</span>";
}
}
ld = new TextField('email');
$field->context(['email'=>'[email protected]']);
echo $field;
$field = new TextField('email');
$field->context(['email'=>'[email protected]'])
->readonly(true);
echo $field;
$field->renderInner()
$field = new TextField('username');
$field->inline(true);
echo $field;
$field = new TextField('product_name');
$field->label('Product Name');
echo $field;
$field = new TextField('product_name');
$field->label(['text'=>'Product Name', 'class'=>'some_class']);
echo $field;
$field = new TextField('name');
$field->label(['text'=>'Name','inline'=>true]);
echo $field;
$field = new TextField('name');
$field
->lidate();
$field = new TextField('name');
$field
->echo $field;
$field = new TextField('name');
$field->lay'=>true,'class'=>'errmsg','style'=>['padding'=>'5px']]);
echo $field;
$field = new TextField('name');
$field->s'=>'errmsg','style'=>['padding'=>'5px']])
->error(false);
echo $field;
$field = new TextField('name');
$field->lay'=>true,'inline'=>true]);
echo $field;
$field = new TextField('amount');
$field->fallback(1);
echo $field;
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.