The Framework PHP Helpers



Examples of PHP Helper class: "HelperLink"

DOWNLOAD version 0.1.0
released at 2018-02-25 19:50 GMT

  1. Download Helpers (zip file)
  2. Unzip it in your vendors folder (e.g)
  3. 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();
  4. Result: Example of HelperInputText



Resume

It allows to create <link rel="..." href="..." type="..."> for css files among other things


Example 1


Live Html

col1col2col3col4col5
Airi SatouAccountantTokyo2008/11/28$162,700
Angelica RamosChief Executive Officer (CEO)London2009/10/09$1,200,000
Ashton CoxJunior Technical AuthorSan Francisco2009/01/12$86,000

PHP Code:

<?php
use TheFramework\Helpers\HelperLink;
use TheFramework\Helpers\HelperTableRaw;
$arHrefs = [
    "https://cdnjs.cloudflare.com/ajax/libs/foundation/6.3.1/css/foundation.min.css",
    "https://cdn.datatables.net/1.10.15/css/jquery.dataTables.min.css"
];
$oLink = new HelperLink($arHrefs);
$oLink->add_href("https://code.jquery.com/ui/1.7.2/themes/smoothness/jquery-ui.css");
$oLink->show();

$arTable = [
    ["col1"=>"Airi Satou","col2"=>"Accountant","col3"=>"Tokyo","col4"=>"2008/11/28","col5"=>"$162,700"],
    ["col1"=>"Angelica Ramos","col2"=>"Chief Executive Officer (CEO)","col3"=>"London","col4"=>"2009/10/09","col5"=>"$1,200,000"],
    ["col1"=>"Ashton Cox","col2"=>"Junior Technical Author","col3"=>"San Francisco","col4"=>"2009/01/12","col5"=>"$86,000"]
];
$oTable = new HelperTableRaw($arTable);
$oTable->add_extras("cellspacing","0");
$oTable->add_extras("width","100%");
$oTable->set_id("idExample");
$oTable->add_class("display");
$oTable->add_class("responsive");
$oTable->show();
?>

HTML Result:

<link type="text/css" rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/foundation/6.3.1/css/foundation.min.css">
<link type="text/css" rel="stylesheet" href="https://cdn.datatables.net/1.10.15/css/jquery.dataTables.min.css">
<link type="text/css" rel="stylesheet" href="https://code.jquery.com/ui/1.7.2/themes/smoothness/jquery-ui.css">
<table id="idExample" class="display responsive" cellspacing="0" width="100%">
<tr><th>col1</th><th>col2</th><th>col3</th><th>col4</th><th>col5</th></tr>
<tr><td>Airi Satou</td><td>Accountant</td><td>Tokyo</td><td>2008/11/28</td><td>$162,700</td></tr>
<tr><td>Angelica Ramos</td><td>Chief Executive Officer (CEO)</td><td>London</td><td>2009/10/09</td><td>$1,200,000</td></tr>
<tr><td>Ashton Cox</td><td>Junior Technical Author</td><td>San Francisco</td><td>2009/01/12</td><td>$86,000</td></tr>
</table>