| 1 |
<?php |
| 2 |
/** |
| 3 |
* This example illustrates the use of the |
| 4 |
* ActiveTab Widget. This widget gives you |
| 5 |
* the ability to build content for n # of tabs |
| 6 |
* and have the browser switch between the tabs |
| 7 |
* without a request to the server. |
| 8 |
* |
| 9 |
* $Id: widget8.php,v 1.5 2004/02/04 00:26:38 hemna Exp $ |
| 10 |
* |
| 11 |
* @author Walter A. Boring IV <waboring@buildabetterweb.com> |
| 12 |
* @package phpHtmlLib |
| 13 |
* @subpackage widget-examples |
| 14 |
* @version 2.0 |
| 15 |
* |
| 16 |
*/ |
| 17 |
|
| 18 |
/** |
| 19 |
* Include the phphtmllib libraries |
| 20 |
* |
| 21 |
*/ |
| 22 |
include("includes.inc"); |
| 23 |
include_once($phphtmllib."/widgets/ActiveTab.inc"); |
| 24 |
|
| 25 |
//create the page object |
| 26 |
$page = new HTMLPageClass("phpHtmlLib Widgets - ActiveTab Example", |
| 27 |
XHTML_TRANSITIONAL); |
| 28 |
|
| 29 |
//enable output debugging. |
| 30 |
if (isset($_GET['debug'])) { |
| 31 |
$page->set_text_debug( TRUE ); |
| 32 |
} |
| 33 |
//use the default theme |
| 34 |
$page->add_css_link( "/phphtmllib/css/defaulttheme.php" ); |
| 35 |
|
| 36 |
|
| 37 |
//build the active tab widget |
| 38 |
//with a width of 500 pixels wide |
| 39 |
//and a height (MUST BE SET) of 200px tall. |
| 40 |
$tab = new ActiveTab(500, "300px"); |
| 41 |
|
| 42 |
//build a NavTable widget |
| 43 |
$navtable = new NavTable("NavTable", "Widget", "200"); |
| 44 |
$navtable->add("#", "Some Link", "This is title text"); |
| 45 |
$navtable->add("#", "Another"); |
| 46 |
$navtable->add_blank(); |
| 47 |
$navtable->add("#", "Some Link", "This is title text"); |
| 48 |
$navtable->add("#", "Another"); |
| 49 |
|
| 50 |
//build a VerticalCSSNavTable widget |
| 51 |
$cssnavtable = new VerticalCSSNavTable("VerticalCSSNavTable", "Widget", "300"); |
| 52 |
$cssnavtable->add("#", "Some Link", "This is title text"); |
| 53 |
$cssnavtable->add("#", "Another"); |
| 54 |
$cssnavtable->add("#", "Another", "This is title text"); |
| 55 |
|
| 56 |
//build a form for one of the tabs |
| 57 |
$formname = "fooform"; |
| 58 |
$form = html_form($formname, "#"); |
| 59 |
$form->add( form_active_checkbox("foo", "some foo text", "ass"),html_br() ); |
| 60 |
$form->add( form_active_checkbox("bar", "some bar text", "bar"),html_br() ); |
| 61 |
$form->add( form_active_checkbox("blah", "some blah text", "blah"), html_br() ); |
| 62 |
$form->add( html_br(2) ); |
| 63 |
|
| 64 |
$form->add( form_active_radio("assradio", array("foo"=>1, "bar"=>2), 2, FALSE ) ); |
| 65 |
$form->add( html_br(2), |
| 66 |
form_active_radio("assradio2", array("foo"=>1, "bar"=>2, "testing"=> 3), 2 )); |
| 67 |
|
| 68 |
|
| 69 |
//now add the tabs and their content. |
| 70 |
$tab->add_tab("Foo Tab", $navtable); |
| 71 |
$tab->add_tab("Bar", $form); |
| 72 |
$tab->add_tab("Hemna", $cssnavtable, TRUE); |
| 73 |
$tab->add_tab("Walt", "Walt tab content"); |
| 74 |
|
| 75 |
//add the tab to the page and render everything. |
| 76 |
$page->add( $tab ); |
| 77 |
print $page->render(); |
| 78 |
?> |