Cgiapp2
[ class tree: Cgiapp2 ] [ index: Cgiapp2 ] [ all elements ]

Source for file Interface.class.php

Documentation is available at Interface.class.php

  1. <?php
  2. /**
  3. * Cgiapp2 - Framework for building reusable web-applications
  4. *
  5. * A PHP5 port of perl's CGI::Application, a framework for building reusable web
  6. * applications.
  7. *
  8. * @package Cgiapp2
  9. * @author Matthew Weier O'Phinney <mweierophinney@gmail.com>; based on
  10. * CGI::Application, by Jesse Erlbaum <jesse@erlbaum.net>, et. al.
  11. * @copyright (c) 2004 - present, Matthew Weier O'Phinney
  12. * @license BSD License (http://www.opensource.org/licenses/bsd-license.php)
  13. * @category Tools and Utilities
  14. * @tutorial Cgiapp2/Cgiapp2.cls
  15. * @version $Id:$
  16. */
  17.  
  18. /**
  19. * Cgiapp2_Plugin_Template_Interface
  20. *
  21. * Defines an interface for a template plugin. A template engine should
  22. * implement {@link init() an initialization method},
  23. * {@link assign() a variable assignment method}, and
  24. * {@link fetch() a method for fetching the compiled template}.
  25. *
  26. * Template plugins that utilize this interface will work seamlessly with
  27. * Cgiapp2's {@link Cgiapp2::tmpl_path()}, {@link Cgiapp2::tmpl_assign()}, and
  28. * {@link Cgiapp2::load_tmpl()} methods.
  29. *
  30. * Since a {@link Cgiapp2} derived class is passed to each, the template engine
  31. * may choose to register itself with that class using the
  32. * {@link Cgiapp2::param()} method. Alternatively, it may implement a singleton;
  33. * these details are left to the programmer.
  34. *
  35. * The plugin class should then register itself with Cgiapp2 or a Cgiapp2-derived
  36. * class via {@link Cgiapp2::add_callback()}:
  37. * <code>
  38. * class MyTemplatePlugin implements Cgiapp2_Plugin_Template_Interface { //... }
  39. * Cgiapp2::add_callback('tmpl_path', array('MyTemplatePlugin', 'init'), 'Cgiapp2');
  40. * Cgiapp2::add_callback('tmpl_assign', array('MyTemplatePlugin', 'assign'), 'Cgiapp2');
  41. * Cgiapp2::add_callback('tmpl_fetch', array('MyTemplatePlugin', 'fetch'), 'Cgiapp2');
  42. * </code>
  43. *
  44. * @package Cgiapp2
  45. * @author Matthew Weier O'Phinney <mweierophinney@gmail.com>
  46. * @copyright 2006-Present, Matthew Weier O'Phinney <mweierophinney@gmail.com>
  47. * @version @release-version@
  48. */
  49. interface Cgiapp2_Plugin_Template_Interface
  50. {
  51. /**
  52. * Initialize template engine
  53. *
  54. * Note: Classes that implement must include the class hint for the $cgiapp
  55. * argument.
  56. *
  57. * @static
  58. * @access public
  59. * @param Cgiapp2 $cgiapp
  60. * @param string $tmpl_path
  61. * @param array $extra_params
  62. * @return bool
  63. */
  64. public static function init(Cgiapp2 $cgiapp, $tmpl_path, $extra_params = null);
  65.  
  66. /**
  67. * Assign variables to the template
  68. *
  69. * Note: Classes that implement must include the class hint for the $cgiapp
  70. * argument.
  71. *
  72. * @static
  73. * @access public
  74. * @param Cgiapp2 $cgiapp
  75. * @return bool
  76. */
  77. public static function assign(Cgiapp2 $cgiapp);
  78.  
  79. /**
  80. * Fetch compiled template
  81. *
  82. * Note: Classes that implement must include the class hint for the $cgiapp
  83. * argument.
  84. *
  85. * @static
  86. * @access public
  87. * @param Cgiapp2 $cgiapp
  88. * @param mixed $tmpl_file
  89. * @return string
  90. */
  91. public static function fetch(Cgiapp2 $cgiapp, $tmpl_file);
  92. }

Documentation generated on Sat, 03 Jun 2006 10:48:43 -0400 by phpDocumentor 1.3.0RC5