My favorites | Sign in
Project Logo
                
Search
for
Updated Mar 04, 2009 by tobiasz.cudnik
valuesToSelectorAttrMethodPHP  

valuesToSelectorAttr

Wiki > Syntax > valuesTo > valuesToSelectorAttr

Parameters

Description

Injects markup from $values' content (rows or attributes) as attribute of nodes matched by selector. Method uses actually matched nodes as root for the query.

Method doesn't change selected elements stack.

Example

Markup

 <p class='field1'>lorem ipsum</p>
 <p class='field2'>lorem ipsum</p>

Data

 $values = array(
     'field1' => '<foo/>',
     'field2' => '<bar/>'
 );

QueryTemplates formula

 $template->
     valuesToSelectorAttr('rel', $values)
 ;

Template

 <p class="field1" rel="&lt;foo/&gt;">lorem ipsum</p>
 <p class="field2" rel="&lt;bar/&gt;">lorem ipsum</p>

Template tree before

 p.field1
  - Text:lorem ipsum
 p.field2
  - Text:lorem ipsum

Template tree after

 p.field1
  - Text:lorem ipsum
 p.field2
  - Text:lorem ipsum

See also

Comments allowed


Sign in to add a comment
Hosted by Google Code