<?php

class makeHTML
{
    public function makeH1($item)
    {
        return "<h1> {$item} </h1> \n";
    }
    public function makeList($items)
    {
        $result = '<ul>';
        foreach ($items as $item) {
            $result .= '<li> <a href="' . $item . '" target="_blank"> ' . $item . ' </a> </li>';
        }
        $result .= '</ul>';
        return $result;
    }
    public function makeDropDownList($items)
    {
        $result = '<select>';
        foreach ($items as $item) {
            $result .= '<option value=' . $item . '>' . $item . '</option>';
        }
        $result .= '</select>';
        return $result;
    }
}
$html = new makeHTML();
//echo $html->makeH1('Hello world');
//
echo $html->makeDropDownList(array('param1', 'param2', 'param3'));
Exemple #2
0
<?php

/*
@File:login.php
@Author:Shailender Singh
@Date:28/02/2015
@Email:hi2shailender@gmail.com
*/
require_once 'conf/config.php';
require_once 'classes/security.class.03.php';
require_once 'classes/html.class.03.php';
$loginForm = new makeHTML($login);
if ($loginForm->checkData()) {
    // this checks is there is any $_POST, then filters and validates. If everything is OK sends user to the success page.
    header('Location: success.php');
} else {
    $formHTML = $loginForm->writeWholeForm($login);
}
//end if/else checkData()
$title = 'form';
// this is a static call to a method. The class does not have to be instantiated.
echo makeHTML::makeHeader($title);
echo '<h1>With a config file, static calls to methods</h1>';
echo '<div id="content">';
echo $formHTML;
echo '</div>';
echo makeHTML::makeFooter();
// EOF
Exemple #3
0
<?php

/*
@File:form.php
@Author:Shailender Singh
@Date:28/02/2015
@Email:hi2shailender@gmail.com
*/
require_once 'conf/config.php';
require_once 'classes/security.class.03.php';
require_once 'classes/html.class.03.php';
$oForm = new makeHTML($aForm);
if ($oForm->checkData()) {
    // this checks is there is any $_POST, then filters and validates. If everything is OK sends user to the success page.
    header('Location: success.php');
} else {
    $formHTML = $oForm->writeWholeForm($aForm);
}
//end if/else checkData()
$title = 'form';
// this is a static call to a method. The class does not have to be instantiated.
echo makeHTML::makeHeader($title);
echo '<h1>With a config file, static calls to methods</h1>';
echo '<div id="content">';
echo $formHTML;
echo '</div>';
echo makeHTML::makeFooter();
// EOF OOP-07.php