ApPHP Tabs Pro - Example of Code

Show Plain Text »
  1. <?php
  2.  
  3. ## +---------------------------------------------------------------------------+
  4. ## | 1. Creating & Calling:                                                    |
  5. ## +---------------------------------------------------------------------------+
  6. ## *** define a relative (virtual) path to tabs.class.php file
  7. define ("TABS_DIR", "");   /* Ex.: "tabs/" */
  8. ## *** include Tabs class
  9. require_once(TABS_DIR."tabs.class.php");
  10. ## *** create Tabs object
  11. $tabs = new Tabs();
  12.  
  13. ## +---------------------------------------------------------------------------+
  14. ## | 2. General Settings:                                                      |
  15. ## +---------------------------------------------------------------------------+
  16. ## *** set unique numeric (integer-valued) identifier for Tabs
  17. ## *** (if you want to use several independently configured Tabs objects on single page)
  18. $tabs->SetId(23);
  19. ##  *** set style for Tabs
  20. ##  *** "xp", "dark-red", "light-green", "g-style", "grey", "black" or your own style
  21. $tabs->SetStyle("g-style");
  22. ## *** show debug info - false|true
  23. $tabs->Debug(true);
  24. ## *** choose mode of displaying child tabs - links|dropdown|tabs
  25. $tabs->SetChildTabsType("dropdown");
  26. ## *** set form submission type: "get", "post" or "ajax"
  27. $tabs->SetSubmissionType("post");
  28.  
  29. ## +---------------------------------------------------------------------------+
  30. ## | 3. Adding tabs:                                                           |
  31. ## +---------------------------------------------------------------------------+
  32. ## *** add tabs
  33. ## arguments:
  34. ## arg #1 - tab's caption
  35. ## arg #2 - file associated with this tab (optional)
  36. ## arg #3 - icon associated with this tab (optional)
  37. ## arg #4 - tab's tooltip
  38. ## Example 1: $tabs->AddTab("Title");
  39. ## Example 2: $tabs->AddTab("Title", "text.txt");
  40. ## Example 3: $tabs->AddTab("Title", "text.txt", "icon.gif");
  41. ## Example 4: $tabs->AddTab("Title", "text.txt", "icon.gif", "tooltip");
  42.  
  43. $son = $tabs->AddTab("Son's Title #1");
  44. $son2 = $tabs->AddTab("Son's Title #2");
  45. $grandson1=$son->AddTab("Grandson's Title #1");
  46. $grandson2=$son->AddTab("Grandson's Title #2", "examples/code.php");
  47.  
  48. ## +---------------------------------------------------------------------------+
  49. ## | 7. Draw Tabs:                                                             |
  50. ## +---------------------------------------------------------------------------+
  51. $tabs->Display();
  52.    
  53. ?>