web/lib/Zend/View/Interface.php
changeset 64 162c1de6545a
parent 19 1c2f13fd785c
child 68 ecaf28ffe26e
equal deleted inserted replaced
63:5b37998e522e 64:162c1de6545a
       
     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-2010 Zend Technologies USA Inc. (http://www.zend.com)
       
    18  * @license    http://framework.zend.com/license/new-bsd     New BSD License
       
    19  * @version    $Id: Interface.php 20210 2010-01-12 02:06:34Z yoshida@zend.co.jp $
       
    20  */
       
    21 
       
    22 
       
    23 /**
       
    24  * Interface class for Zend_View compatible template engine implementations
       
    25  *
       
    26  * @category   Zend
       
    27  * @package    Zend_View
       
    28  * @copyright  Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
       
    29  * @license    http://framework.zend.com/license/new-bsd     New BSD License
       
    30  */
       
    31 interface Zend_View_Interface
       
    32 {
       
    33     /**
       
    34      * Return the template engine object, if any
       
    35      *
       
    36      * If using a third-party template engine, such as Smarty, patTemplate,
       
    37      * phplib, etc, return the template engine object. Useful for calling
       
    38      * methods on these objects, such as for setting filters, modifiers, etc.
       
    39      *
       
    40      * @return mixed
       
    41      */
       
    42     public function getEngine();
       
    43 
       
    44     /**
       
    45      * Set the path to find the view script used by render()
       
    46      *
       
    47      * @param string|array The directory (-ies) to set as the path. Note that
       
    48      * the concrete view implentation may not necessarily support multiple
       
    49      * directories.
       
    50      * @return void
       
    51      */
       
    52     public function setScriptPath($path);
       
    53 
       
    54     /**
       
    55      * Retrieve all view script paths
       
    56      *
       
    57      * @return array
       
    58      */
       
    59     public function getScriptPaths();
       
    60 
       
    61     /**
       
    62      * Set a base path to all view resources
       
    63      *
       
    64      * @param  string $path
       
    65      * @param  string $classPrefix
       
    66      * @return void
       
    67      */
       
    68     public function setBasePath($path, $classPrefix = 'Zend_View');
       
    69 
       
    70     /**
       
    71      * Add an additional path to view resources
       
    72      *
       
    73      * @param  string $path
       
    74      * @param  string $classPrefix
       
    75      * @return void
       
    76      */
       
    77     public function addBasePath($path, $classPrefix = 'Zend_View');
       
    78 
       
    79     /**
       
    80      * Assign a variable to the view
       
    81      *
       
    82      * @param string $key The variable name.
       
    83      * @param mixed $val The variable value.
       
    84      * @return void
       
    85      */
       
    86     public function __set($key, $val);
       
    87 
       
    88     /**
       
    89      * Allows testing with empty() and isset() to work
       
    90      *
       
    91      * @param string $key
       
    92      * @return boolean
       
    93      */
       
    94     public function __isset($key);
       
    95 
       
    96     /**
       
    97      * Allows unset() on object properties to work
       
    98      *
       
    99      * @param string $key
       
   100      * @return void
       
   101      */
       
   102     public function __unset($key);
       
   103 
       
   104     /**
       
   105      * Assign variables to the view script via differing strategies.
       
   106      *
       
   107      * Suggested implementation is to allow setting a specific key to the
       
   108      * specified value, OR passing an array of key => value pairs to set en
       
   109      * masse.
       
   110      *
       
   111      * @see __set()
       
   112      * @param string|array $spec The assignment strategy to use (key or array of key
       
   113      * => value pairs)
       
   114      * @param mixed $value (Optional) If assigning a named variable, use this
       
   115      * as the value.
       
   116      * @return void
       
   117      */
       
   118     public function assign($spec, $value = null);
       
   119 
       
   120     /**
       
   121      * Clear all assigned variables
       
   122      *
       
   123      * Clears all variables assigned to Zend_View either via {@link assign()} or
       
   124      * property overloading ({@link __get()}/{@link __set()}).
       
   125      *
       
   126      * @return void
       
   127      */
       
   128     public function clearVars();
       
   129 
       
   130     /**
       
   131      * Processes a view script and returns the output.
       
   132      *
       
   133      * @param string $name The script name to process.
       
   134      * @return string The script output.
       
   135      */
       
   136     public function render($name);
       
   137 }