Overview

Packages

  • View
    • Helper

Classes

  • Horde_View_Helper_Base
  • Horde_View_Helper_Benchmark
  • Horde_View_Helper_Benchmark_Timer
  • Horde_View_Helper_Block
  • Horde_View_Helper_Capture
  • Horde_View_Helper_Capture_Base
  • Horde_View_Helper_Capture_ContentFor
  • Horde_View_Helper_Date
  • Horde_View_Helper_Debug
  • Horde_View_Helper_Form
  • Horde_View_Helper_Form_Builder
  • Horde_View_Helper_Form_InstanceTag_Base
  • Horde_View_Helper_Form_InstanceTag_Form
  • Horde_View_Helper_FormTag
  • Horde_View_Helper_Javascript
  • Horde_View_Helper_Number
  • Horde_View_Helper_Tag
  • Horde_View_Helper_Text
  • Horde_View_Helper_Text_Cycle
  • Horde_View_Helper_Url
  • Overview
  • Package
  • Class
  • Tree
 1: <?php
 2: /**
 3:  * Copyright 2007-2008 Maintainable Software, LLC
 4:  * Copyright 2008-2012 Horde LLC (http://www.horde.org/)
 5:  *
 6:  * @author     Mike Naberezny <mike@maintainable.com>
 7:  * @author     Derek DeVries <derek@maintainable.com>
 8:  * @author     Chuck Hagenbuch <chuck@horde.org>
 9:  * @license    http://www.horde.org/licenses/bsd
10:  * @category   Horde
11:  * @package    View
12:  * @subpackage Helper
13:  */
14: 
15: /**
16:  * Capture lets you extract parts of code which can be used in other points of
17:  * the template or even layout file.
18:  *
19:  * @author     Mike Naberezny <mike@maintainable.com>
20:  * @author     Derek DeVries <derek@maintainable.com>
21:  * @author     Chuck Hagenbuch <chuck@horde.org>
22:  * @license    http://www.horde.org/licenses/bsd
23:  * @category   Horde
24:  * @package    View
25:  * @subpackage Helper
26:  */
27: class Horde_View_Helper_Capture extends Horde_View_Helper_Base
28: {
29:     /**
30:      * Capture allows you to extract a part of the template into an instance
31:      * variable.
32:      *
33:      * You can use this instance variable anywhere in your templates and even
34:      * in your layout. Example:
35:      *
36:      * <code>
37:      * <?php $capture = $this->capture() ?>
38:      * Welcome To my shiny new web page!
39:      * <?php $this->greeting = $capture->end() ?>
40:      * </code>
41:      *
42:      * @return Horde_View_Helper_Capture_Base
43:      */
44:     public function capture()
45:     {
46:         return new Horde_View_Helper_Capture_Base();
47:     }
48: 
49:     /**
50:      * Calling contentFor() stores the block of markup for later use.
51:      *
52:      * Subsequently, you can retrieve it inside an instance variable
53:      * that will be named "contentForName" in another template
54:      * or in the layout.  Example:
55:      *
56:      * <code>
57:      * <?php $capture = $this->contentFor("header") ?>
58:      * <script type="text/javascript">alert('hello world')</script>
59:      * <?php $capture->end() ?>
60:      *
61:      * // Use $this->contentForHeader anywhere in your templates:
62:      * <?php echo $this->contentForHeader ?>
63:      * </code>
64:      *
65:      * @param string $name  Name of the content that becomes the instance
66:      *                      variable name. "foo" -> "$this->contentForFoo"
67:      * @return Horde_View_Helper_Capture_ContentFor
68:      */
69:     public function contentFor($name)
70:     {
71:         return new Horde_View_Helper_Capture_ContentFor($name, $this->_view);
72:     }
73: }
74: 
API documentation generated by ApiGen