Note that there are some explanatory texts on larger screens.

plurals
  1. POZend_Framework Decorators Wrap Label and ViewHelper inside a div
    primarykey
    data
    text
    <p>I am new to this, zend decoration malarchy, but i have two significant questions that i cant get my head around. Question one is followed by some example</p> <pre><code>$decorate = array( array('ViewHelper'), array('Description'), array('Errors', array('class'=&gt;'error')), array('Label', array('tag'=&gt;'div', 'separator'=&gt;' ')), array('HtmlTag', array('tag' =&gt; 'li', 'class'=&gt;'element')), ); ... $name = new Zend_Form_Element_Text('title'); $name-&gt;setLabel('Title') -&gt;setDescription("No --- way"); $name-&gt;setDecorator($decorate); </code></pre> <p>Which outputs</p> <pre><code>&lt;li class="element"&gt; &lt;label for="title" class="required"&gt;Title&lt;/label&gt; &lt;input type="text" name="title" id="title" value=""&gt; &lt;p class="hint"&gt;No --- way&lt;/p&gt; &lt;ul class="error"&gt; &lt;li&gt;Value is required and can't be empty&lt;/li&gt; &lt;/ul&gt; &lt;/li&gt; </code></pre> <h1>The Question #1</h1> <p>How do i wrap the <code>label</code> and the <code>input</code> around a div tag? So the output is as follows:</p> <pre><code>&lt;li class="element"&gt; &lt;div&gt; &lt;label for="title" class="required"&gt;Title&lt;/label&gt; &lt;input type="text" name="title" id="title" value=""&gt; &lt;/div&gt; &lt;p class="hint"&gt;No --- way&lt;/p&gt; &lt;ul class="error"&gt; &lt;li&gt;Value is required and can't be empty&lt;/li&gt; &lt;/ul&gt; &lt;/li&gt; </code></pre> <hr> <h1>The Question #2</h1> <p>What is up with the order of the <code>elements</code> in the <code>$decorate</code> array? <em>They MAKE NO SENSE!</em></p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload