- Download Helpers (zip file)
- Unzip it in your vendors folder (e.g)
-
Include autoload.php in your bootstrap file
<?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();
-
Result:
PHP Class code
<?php
/**
* @author Eduardo Acevedo Farje.
* @link www.eduardoaf.com
* @version 1.0.3
* @name HelperDiv
* @date 01-01-2016 16:21
* @file helper_div.php
*/
namespace TheFramework\Helpers;
use TheFramework\Helpers\TheFrameworkHelper;
class HelperDiv extends TheFrameworkHelper
{
public function __construct($innerhtml="", $id="", $class="", $style="", $arExtras=array())
{
$this->_type = "div";
$this->_idprefix = "";
$this->_id = $id;
$this->_inner_html = $innerhtml;
if($class) $this->arClasses[] = $class;
if($style) $this->arStyles[] = $style;
$this->arExtras = $arExtras;
}
//Fieldset
public function get_html()
{
$sHtmlToReturn = $this->get_opentag();
//Agrega a inner_html los valores obtenidos con
$this->load_inner_objects();
$sHtmlToReturn .= $this->_inner_html;
$sHtmlToReturn .= $this->get_closetag();
return $sHtmlToReturn;
}
public function get_opentag()
{
$sHtmlOpenTag = "<$this->_type";
if($this->_id) $sHtmlOpenTag .= " id=\"$this->_idprefix$this->_id\"";
//eventos
if($this->_js_onblur) $sHtmlOpenTag .= " onblur=\"$this->_js_onblur\"";
if($this->_js_onchange) $sHtmlOpenTag .= " onchange=\"$this->_js_onchange\"";
if($this->_js_onclick) $sHtmlOpenTag .= " onclick=\"$this->_js_onclick\"";
if($this->_js_onkeypress) $sHtmlOpenTag .= " onkeypress=\"$this->_js_onkeypress\"";
if($this->_js_onfocus) $sHtmlOpenTag .= " onfocus=\"$this->_js_onfocus\"";
if($this->_js_onmouseover) $sHtmlOpenTag .= " onmouseover=\"$this->_js_onmouseover\"";
if($this->_js_onmouseout) $sHtmlOpenTag .= " onmouseout=\"$this->_js_onmouseout\"";
//aspecto
$this->load_cssclass();
if($this->_class) $sHtmlOpenTag .= " class=\"$this->_class\"";
$this->load_style();
if($this->_style) $sHtmlOpenTag .= " style=\"$this->_style\"";
//atributos extra
if($this->_attr_dbfield) $sHtmlOpenTag .= " dbfield=\"$this->_attr_dbfield\"";
if($this->_attr_dbtype) $sHtmlOpenTag .= " dbtype=\"$this->_attr_dbtype\"";
if($this->arExtras) $sHtmlOpenTag .= " ".$this->get_extras();
$sHtmlOpenTag .= ">\n";
return $sHtmlOpenTag;
//TODO
}
//**********************************
// SETS
//**********************************
//**********************************
// GETS
//**********************************
//**********************************
// MAKE PUBLIC
//**********************************
public function show_opentag(){parent::show_opentag();}
public function show_closetag(){parent::show_closetag();}
}
Back to Top