| 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.2 2003/02/21 18:39:11 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 | $page->set_text_debug( $_GET["debug"] ); | 
| 31 | //use the default theme | 
| 32 | $page->add_css_link( "/phphtmllib/css/defaulttheme.php" ); | 
| 33 |  | 
| 34 |  | 
| 35 | //build the active tab widget | 
| 36 | //with a width of 500 pixels wide | 
| 37 | //and a height (MUST BE SET) of 200px tall. | 
| 38 | $tab = new ActiveTab(500, "220px"); | 
| 39 |  | 
| 40 | //build a NavTable widget | 
| 41 | $navtable = new NavTable("NavTable", "Widget", "200"); | 
| 42 | $navtable->add("#", "Some Link", "This is title text"); | 
| 43 | $navtable->add("#", "Another"); | 
| 44 | $navtable->add_blank(); | 
| 45 | $navtable->add("#", "Some Link", "This is title text"); | 
| 46 | $navtable->add("#", "Another"); | 
| 47 |  | 
| 48 | //build a VerticalCSSNavTable widget | 
| 49 | $cssnavtable = new VerticalCSSNavTable("VerticalCSSNavTable", "Widget", "300"); | 
| 50 | $cssnavtable->add("#", "Some Link", "This is title text"); | 
| 51 | $cssnavtable->add("#", "Another"); | 
| 52 | $cssnavtable->add("#", "Another", "This is title text"); | 
| 53 |  | 
| 54 | //build a form for one of the tabs | 
| 55 | $formname = "fooform"; | 
| 56 | $form = html_form($formname, "#"); | 
| 57 | $form->add( form_active_checkbox("foo", "some foo text", "ass"),html_br() ); | 
| 58 | $form->add( form_active_checkbox("bar", "some bar text", "bar"),html_br() ); | 
| 59 | $form->add( form_active_checkbox("blah", "some blah text", "blah"), html_br() ); | 
| 60 | $form->add( html_br(2) ); | 
| 61 |  | 
| 62 | $form->add( form_active_radio("assradio", array("foo"=>1, "bar"=>2), 2, FALSE ) ); | 
| 63 | $form->add( html_br(2), | 
| 64 | form_active_radio("assradio2", array("foo"=>1, "bar"=>2, "testing"=> 3), 2 ) ); | 
| 65 |  | 
| 66 |  | 
| 67 | //now add the tabs and their content. | 
| 68 | $tab->add_tab("Foo Tab", $navtable); | 
| 69 | $tab->add_tab("Bar", $form); | 
| 70 | $tab->add_tab("Hemna", $cssnavtable, TRUE); | 
| 71 | $tab->add_tab("Walt", "Walt tab content"); | 
| 72 |  | 
| 73 | //add the tab to the page and render everything. | 
| 74 | $page->add( $tab ); | 
| 75 | print $page->render(); | 
| 76 | ?> |