Example #1
0
<?php

include "SuperHTMLDef.php";
$s = new SuperHTML("Working with Forms");
$s->buildTop();
$s->h3("form elements");
$s->addText("<form> \n");
$s->textbox("userName", "Joe");
$s->h3("create select object from associative array");
$numArray = array("1" => "ichii", "2" => "nii", "3" => "san", "4" => "shi");
$s->select("options", $numArray);
$s->h3("make form elements inside a table!");
$myArray = array(array($s->gTag("b", "name"), $s->gTextbox("name")), array("address", $s->gTextbox("address")), array("phone", $s->gTextbox("phone")), array("favorite number", $s->gSelect("number", $numArray)));
$s->buildTable($myArray);
$s->submit();
$s->addText("</form> \n");
$s->h3("results from previous form (if any)");
$s->formResults();
$s->buildBottom();
print $s->getPage();
?>




<?php

//import the definition of SuperHTML
include "SuperHTMLDef.php";
//instantiate and use a superHTML page
$s = new SuperHTML("My Super Duper Page!");
$s->setTitle("SuperHTML Demo");
$s->buildTop();
$s->h3("Using the tag method");
$s->tag("i", "This line should be italicized");
$s->h3("adding arbitrary text");
$s->addText("I used the addText method here");
$s->h3("build table from 2d array");
$myArray = array(array("English", "Spanish", "Japanese"), array("One", "Uno", "Ichi"), array("Two", "Dos", "Nii"), array("Three", "Tres", "San"));
$s->buildTable($myArray);
$s->h3("build table row-by-row");
$s->startTable(3);
$s->tRow(array("English", "Greek"), "th");
$s->tRow(array("a", "alpha"));
$s->tRow(array("b", "beta"));
$s->endTable();
$s->h3("build an unordered list");
$s->buildList(array("alpha", "beta", "gamma", "delta"));
$s->h3("build an ordered list");
$s->buildList(array("alpha", "beta", "gamma", "delta"), "ol type = 'a'");
$s->h3("form elements");
$s->addText("<form> \n");
$s->textbox("user name", "Joe");
$s->h3("create select object from associative array");
$numArray = array("1" => "ichii", "2" => "nii", "3" => "san", "4" => "shi");
$s->buildSelect("options", $numArray);
Example #3
0
<?php

include "SuperHTMLDef.php";
$s = new SuperHTML("Creating Tables");
$s->buildTop();
$s->h3("build table from 2d array");
$myArray = array(array("English", "Spanish", "Japanese"), array("One", "Uno", "Ichi"), array("Two", "Dos", "Nii"), array("Three", "Tres", "San"));
$s->buildTable($myArray);
$s->h3("build table row-by-row");
$s->startTable(3);
$s->tRow(array("English", "Greek"), "th");
$s->tRow(array("a", "alpha"));
$s->tRow(array("b", "beta"));
$s->endTable();
$s->buildBottom();
print $s->getPage();
?>




Example #4
0
<?php

include "SuperHTMLDef.php";
$s = new SuperHTML("Creating Lists");
$s->buildTop();
$myArray = array("alpha", "beta", "gamma", "delta");
$s->h3("build an ordered list");
$s->buildList($myArray, "ol");
$s->h3("unordered lists are the default");
$s->buildList(array("alpha", "beta", "gamma", "delta"));
$s->h3("specify list type");
$s->buildList($myArray, "ol type = 'a'");
$s->buildBottom();
print $s->getPage();
?>




<?php

include "SuperHTMLDef.php";
$s = new SuperHTML("Basic Super Page");
$s->buildTop();
$s->buildBottom();
print $s->getPage();
?>




<?php

include "SuperHTMLDef.php";
$s = new SuperHTML("Basic Super Page");
$s->setTitle("I changed this");
$s->buildTop();
print "The title is now " . $s->getTitle();
$s->buildBottom();
print $s->getPage();
?>




Example #7
0
<?php

include "superHTMLDefa.php";
if (!filter_has_var(INPUT_POST, "user")) {
    $p = new SuperHTML("Hobby SuperHTML -- Form");
    $p->buildTop("This is the new hobby form");
    $p->startForm("hobbySuperHTML.php", "POST");
    $p->h1($p->label("Your Name: ") . $p->textbox('user', ""));
    $p->h1($p->label("Email Address: ") . $p->textbox('email', ""));
    $p->h1($p->label("Your Hobby: ") . $p->textbox('hobby', ""));
    $p->submit("Submit");
    $p->endForm();
    $p->buildBottom();
    print $p->getPage();
} else {
    $q = new SuperHTML("Thank you for using this form");
    $q->buildTop("Here is your input");
    $q->h1("Hello, {$user}!");
    $q->h1("Your email address as: {$email},");
    $q->h1("and your favorite hobby is: {$hobby}.");
    $q->buildBottom();
    print $q->getPage();
}
<?php

include "SuperHTMLDef.php";
$s = new SuperHTML("Adding Text and Tags");
$s->buildTop();
$s->addText("This is ordinary text added to the document");
$s->addText("<div>You can also add HTML code <hr> like the HR above</div>");
$s->h3("Use h1-h6 methods to add headings");
$s->tag("i", "this line is italicized");
$s->buildBottom();
print $s->getPage();
?>