php - Can custom decorator access parts of $content -


in custom decorator, i'm wrapping element content div. code creates div around both <dt> label , <dd> element

public function render($content) {            return '<div class="test">' . $content . '</div>'; } 

is there way can further access 2 parts, dd , dt. such maybe wrap div around <dt> or <dd>. how access different parts of $content?

if not necessary create custom decorator want achieve, can try decorating element directly following:

$elementdecorators = array( 'viewhelper', array(array('element'=>'htmltag'), array('tag' => 'dd')), array('label', array('tag' => 'dt')), array(array('wrapper'=>'htmltag'), array('tag' => 'div')), );

that shud produce markup so:

<div> <dt><label/></dt> <dd><input/></dd> </div>

and if want add want within/between/before/after dd or dt can modify thus:

$elementdecorators = array( 'viewhelper', array(array('addition'=>'htmltag'), array('tag' => 'span')), array(array('element'=>'htmltag'), array('tag' => 'dd')), array('label', array('tag' => 'dt')), array(array('wrapper'=>'htmltag'), array('tag' => 'div')), );

that shud produce:

<div> <dt><label/></dt> <dd><span><input/></span></dd> </div>

which wraps span tag around element before dd tag does.

after decorating can add variable decorator of element.


Comments

Popular posts from this blog

ASP.NET/SQL find the element ID and update database -

jquery - appear modal windows bottom -

c++ - Compiling static TagLib 1.6.3 libraries for Windows -