lib.php 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110
  1. <?php
  2. // Sloodle Browser website
  3. // General site functionality
  4. // Written by: Peter R. Bloomfield
  5. // The config.php file MUST be already included!
  6. // Output the header part of a page.
  7. // Includes all the HTML pre-amble, and the main navigation menu
  8. function print_header()
  9. {
  10. global $CFG;
  11. include($CFG->dirroot.'/_page_header.php');
  12. }
  13. // Output the footer part of a page.
  14. // Adds the footer information and closes the HTML part of the page.
  15. function print_footer()
  16. {
  17. global $CFG;
  18. include($CFG->dirroot.'/_page_footer.php');
  19. }
  20. // Start the main content section of a page.
  21. // Should only be called ONCE per page,
  22. // and must have a corresponding call to end_page_content().
  23. function start_page_content()
  24. {
  25. echo "<div id=\"content\">\n";
  26. }
  27. // End the main content section of a page.
  28. function end_page_content()
  29. {
  30. echo "</div>\n";
  31. }
  32. // Start the side content section of a page.
  33. // Should only be called ONCE per page,
  34. // and must have a corresponding call to end_side_content().
  35. // Should be called AFTER end_page_content().
  36. function start_side_content()
  37. {
  38. echo "<div id=\"sidebar\">\n";
  39. }
  40. // End the side content section of a page.
  41. function end_side_content()
  42. {
  43. echo "</div>\n";
  44. }
  45. // Start an "About" box. Should only be called ONCE per page,
  46. // and should have a corresponding call to end_about_box().
  47. // Designed for use within the sidebar section
  48. // $title = title of the box
  49. function start_about_box($title)
  50. {
  51. echo "<div id=\"about-box\">\n";
  52. echo "<h2>{$title}</h2>\n";
  53. echo "<p>\n";
  54. }
  55. function end_about_box()
  56. {
  57. echo "</p>\n</div>\n";
  58. }
  59. // Start a page entry (a box, like a blog post).
  60. // $title = the title of the entry
  61. // $subtitle = the subtitle of the entry (e.g. a posting date, but often left blank)
  62. function start_page_entry($title, $subtitle='')
  63. {
  64. // Start the entry
  65. echo "<div class=\"post\">\n";
  66. // Display the title and (optionally) the subtitle
  67. echo "<h2 class=\"title\">{$title}</h2>\n";
  68. if (!empty($subtitle)) echo "<h3 class=\"date\">{$subtitle}</h3>\n";
  69. // Start the entry section
  70. echo "<div class=\"entry\">\n";
  71. }
  72. // End a page entry
  73. // $meta = a numeric array of extra items to be displayed at the bottom, e.g. a "more" link
  74. function end_page_entry($meta=null)
  75. {
  76. // Close the text section
  77. echo "</div>\n";
  78. // Display the meta information
  79. echo "<p class=\"meta\">\n";
  80. if (is_array($meta)) {
  81. $isfirst = true;
  82. foreach ($meta as $m) {
  83. // Display a separator
  84. if ($isfirst) $isfirst = false;
  85. else echo ' <b>|</b> ';
  86. // Display the item
  87. echo $m;
  88. }
  89. }
  90. echo "</p>\n";
  91. // Done!
  92. echo "</div>\n";
  93. }
  94. ?>