<?php
/*
lets suposse you have this folder tree
yourproject/
vendors/
lib_1/
lib_n/
theframework/ -->uncompressed zip
helpers/
index.php
*/
//this file is: yourproject/index.php
include_once("vendors/theframework/helpers/autoload.php");
use TheFramework\Helpers\HelperInputText;
$oInput = new HelperInputText();
$oInput->set_value("Hello World");
$oInput->add_class("form-control");
$oInput->show();
With this class you can create <button>..</button> element
<?php
use TheFramework\Helpers\HelperButtonBasic;
$arButtons = [];
$arButton["1"] = new HelperButtonBasic("butFirst","Danger");
$arButton["1"]->set_js_onclick("console.log(this.id);alert('danger')");
$arButton["1"]->add_class("btn btn-danger");
//adding extra attributes
$arButton["1"]->add_extras("ng-click","count = count + 1");
$arButton["1"]->add_extras("ng-init","count=0");
$arButton["2"] = new HelperButtonBasic("butSecond","Submit");
$arButton["2"]->set_type("submit");
$arButton["2"]->set_style("margin-left:5px;");
$arButton["2"]->set_js_onclick("console.log(this.id);alert('Data submit');");
$arButton["2"]->add_class("btn btn-info");
foreach($arButton as $oButton)
$oButton->show();
?>
<button type="button" id="butFirst" onclick="console.log(this.id);alert('danger')" class="btn btn-danger" ng-click="count = count + 1" ng-init="count=0">
Danger</button>
<button type="submit" id="butSecond" onclick="console.log(this.id);alert('Data submit');" class="btn btn-info" style="margin-left:5px;">
Submit</button>
<?php
use TheFramework\Helpers\HelperForm;
$oForm = new HelperForm();
$oForm->set_comments("This is a comment");
$oForm->add_style("border:1px dashed #4f9fcf;");
$oForm->add_style("padding:5px;");
$oForm->set_id("myForm");
$oSpan = new TheFramework\Helpers\HelperSpan("@");
$oSpan->set_class("input-group-addon");
$sEmail = isset($_POST["txtEmail"])?$_POST["txtEmail"]:NULL;
$oAux = new TheFramework\Helpers\HelperInputText("txtEmail","txtEmail");
$oAux->set_type("email");
$oAux->required();
$oAux->set_value($sEmail);
$oAux->add_class("form-control");
$oAux->add_extras("placeholder","Recipient's email");
if($sEmail)
{
$oAux->set_style("border:1px solid black");
$oAux->add_style("background:#cc99ff");
$oAux->add_style("color:black");
$oAux->add_extras("autofocus","");
}
$oAux = new TheFramework\Helpers\HelperRaw("<div class=\"input-group\">{$oSpan->get_html()}{$oAux->get_html()}</div>");
$oForm->add_control($oAux);
$oAux = new HelperButtonBasic("butReset","Reset");
$oAux->set_type("reset");
$oAux->add_class("btn btn-info");
$oAux->add_style("margin:15px");
$oForm->add_control($oAux);
$oAux = new HelperButtonBasic("butSubmit","Submit");
$oAux->set_type("submit");
$oAux->add_style("margin:15px");
$oAux->add_class("btn btn-info");
$oForm->add_control($oAux);
$oForm->show();
?>
<!-- This is a comment --> <form id="myForm" method="post" style="border:1px dashed #4f9fcf;;padding:5px;"> <div class="input-group"><span class="input-group-addon">@</span> <input type="email" id="txtEmail" name="txtEmail" value="required@mail.com" maxlength="50" required="" class="form-control" style="border:1px solid black;background:#cc99ff;color:black" placeholder="Recipient's email" autofocus=""> </div><button type="reset" id="butReset" class="btn btn-info" style="margin:15px"> Reset</button><button type="submit" id="butSubmit" class="btn btn-info" style="margin:15px"> Submit</button> </form>