|
codeToSelectorAppendMethodPHP
codeToSelectorAppendWiki > Syntax > codeTo > codeToSelectorAppend Parameters
Target attribute name. Array of raw code, where key is the field. Defines pattern matching target nodes. %k represents key. Defaults to ".%k", which matches nodes with class name equivalent to variables key (field). For example, to restrict match to nodes with additional class "foo" change $selectorPattern to ".foo.%k" Array of keys from $varValue which should be skipped. Callback triggered after every insertion. Three parameters are passed to this callback: DescriptionInjects raw executable code at the end of nodes matched by selector. Method uses actually matched nodes as root for the query. Method doesn't change selected elements stack. ExampleMarkup<p class='field1'>lorem ipsum</p> <p class='field2'>lorem ipsum</p> Data$code = array( 'field1' => 'print "abba";', 'field2' => 'foreach(array(1, 2, 3) as $i) print $i' ); QueryTemplates formula$template-> codeToSelectorAppend($code) ; Template<p class="field1">lorem ipsum<?php print "abba"; ?></p> <p class="field2">lorem ipsum<?php foreach(array(1, 2, 3) as $i) print $i ?></p> Template tree beforep.field1 - Text:lorem ipsum p.field2 - Text:lorem ipsum Template tree afterp.field1 - Text:lorem ipsum - PHP p.field2 - Text:lorem ipsum - PHP See alsoComments allowed |
Sign in to add a comment