Interface.php 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136
  1. <?php
  2. /**
  3. * Zend Framework
  4. *
  5. * LICENSE
  6. *
  7. * This source file is subject to the new BSD license that is bundled
  8. * with this package in the file LICENSE.txt.
  9. * It is also available through the world-wide-web at this URL:
  10. * http://framework.zend.com/license/new-bsd
  11. * If you did not receive a copy of the license and are unable to
  12. * obtain it through the world-wide-web, please send an email
  13. * to license@zend.com so we can send you a copy immediately.
  14. *
  15. * @category Zend
  16. * @package Zend_View
  17. * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
  18. * @license http://framework.zend.com/license/new-bsd New BSD License
  19. */
  20. /**
  21. * Interface class for Zend_View compatible template engine implementations
  22. *
  23. * @category Zend
  24. * @package Zend_View
  25. * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
  26. * @license http://framework.zend.com/license/new-bsd New BSD License
  27. */
  28. interface Zend_View_Interface
  29. {
  30. /**
  31. * Return the template engine object, if any
  32. *
  33. * If using a third-party template engine, such as Smarty, patTemplate,
  34. * phplib, etc, return the template engine object. Useful for calling
  35. * methods on these objects, such as for setting filters, modifiers, etc.
  36. *
  37. * @return mixed
  38. */
  39. public function getEngine();
  40. /**
  41. * Set the path to find the view script used by render()
  42. *
  43. * @param string|array The directory (-ies) to set as the path. Note that
  44. * the concrete view implentation may not necessarily support multiple
  45. * directories.
  46. * @return void
  47. */
  48. public function setScriptPath($path);
  49. /**
  50. * Retrieve all view script paths
  51. *
  52. * @return array
  53. */
  54. public function getScriptPaths();
  55. /**
  56. * Set a base path to all view resources
  57. *
  58. * @param string $path
  59. * @param string $classPrefix
  60. * @return void
  61. */
  62. public function setBasePath($path, $classPrefix = 'Zend_View');
  63. /**
  64. * Add an additional path to view resources
  65. *
  66. * @param string $path
  67. * @param string $classPrefix
  68. * @return void
  69. */
  70. public function addBasePath($path, $classPrefix = 'Zend_View');
  71. /**
  72. * Assign a variable to the view
  73. *
  74. * @param string $key The variable name.
  75. * @param mixed $val The variable value.
  76. * @return void
  77. */
  78. public function __set($key, $val);
  79. /**
  80. * Allows testing with empty() and isset() to work
  81. *
  82. * @param string $key
  83. * @return boolean
  84. */
  85. public function __isset($key);
  86. /**
  87. * Allows unset() on object properties to work
  88. *
  89. * @param string $key
  90. * @return void
  91. */
  92. public function __unset($key);
  93. /**
  94. * Assign variables to the view script via differing strategies.
  95. *
  96. * Suggested implementation is to allow setting a specific key to the
  97. * specified value, OR passing an array of key => value pairs to set en
  98. * masse.
  99. *
  100. * @see __set()
  101. * @param string|array $spec The assignment strategy to use (key or array of key
  102. * => value pairs)
  103. * @param mixed $value (Optional) If assigning a named variable, use this
  104. * as the value.
  105. * @return void
  106. */
  107. public function assign($spec, $value = null);
  108. /**
  109. * Clear all assigned variables
  110. *
  111. * Clears all variables assigned to Zend_View either via {@link assign()} or
  112. * property overloading ({@link __get()}/{@link __set()}).
  113. *
  114. * @return void
  115. */
  116. public function clearVars();
  117. /**
  118. * Processes a view script and returns the output.
  119. *
  120. * @param string $name The script script name to process.
  121. * @return string The script output.
  122. */
  123. public function render($name);
  124. }