| 1 | jonen | 1.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 | jonen | 1.3 | * $Id: widget8.php,v 1.4 2003/07/28 17:02:03 hemna Exp $ | 
| 10 | jonen | 1.1 | * | 
| 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 | jonen | 1.3 | if (isset($_GET['debug'])) { | 
| 31 |  |  | $page->set_text_debug( TRUE ); | 
| 32 |  |  | } | 
| 33 | jonen | 1.1 | //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, "220px"); | 
| 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 | jonen | 1.2 | $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 | jonen | 1.1 | $form->add( html_br(2) ); | 
| 63 |  |  |  | 
| 64 | jonen | 1.2 | $form->add( form_active_radio("assradio", array("foo"=>1, "bar"=>2), 2, FALSE ) ); | 
| 65 | jonen | 1.1 | $form->add( html_br(2), | 
| 66 | jonen | 1.2 | form_active_radio("assradio2", array("foo"=>1, "bar"=>2, "testing"=> 3), 2 ) ); | 
| 67 | jonen | 1.1 |  | 
| 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 |  |  | ?> |