QueryTemplates
[ class tree: QueryTemplates ] [ index: QueryTemplates ] [ all elements ]

Class: QueryTemplatesSyntaxCode

Source Location: /home/bob/workspace/QueryTemplates/src/QueryTemplatesSyntaxCode.php

Class Overview

phpQueryObject
   |
   --QueryTemplatesSyntaxDOM
      |
      --QueryTemplatesSyntaxValues
         |
         --QueryTemplatesSyntaxCode

Class extending phpQueryObject with templating methods.


Author(s):

Methods


Child classes:

QueryTemplatesSyntaxConditions
Class extending phpQueryObject with templating methods.

Inherited Variables

Inherited Methods

Class: QueryTemplatesSyntaxValues

QueryTemplatesSyntaxValues::valuesToForm()
Toggles form fields values and selection states according to static values from $values.
QueryTemplatesSyntaxValues::valuesToLoop()
Method loops provided $values on actually selected nodes. Each time new row is inserted, provided callback is triggered with $dataRow, $node and $dataIndex.
QueryTemplatesSyntaxValues::valuesToLoopBefore()
Method loops provided $values on actually selected nodes. Each time new row is inserted, provided callback is triggered with $dataRow, $node and $dataIndex.
QueryTemplatesSyntaxValues::valuesToLoopFirst()
Method loops provided $values on actually selected nodes. Each time new row is inserted, provided callback is triggered with $dataRow, $node and $dataIndex.
QueryTemplatesSyntaxValues::valuesToLoopSeparate()
Method loops provided $values on actually selected nodes. Each time new row is inserted, provided callback is triggered with $dataRow, $node and $dataIndex.
QueryTemplatesSyntaxValues::valuesToStack()
Injects markup from $values' content (rows or attributes) inside actually selected nodes.
QueryTemplatesSyntaxValues::valuesToStackAfter()
Injects markup from $values' content (rows or attributes) inside actually selected nodes.
QueryTemplatesSyntaxValues::valuesToStackAppend()
Injects markup from $values' content (rows or attributes) inside actually selected nodes.
QueryTemplatesSyntaxValues::valuesToStackAttr()
Injects markup from $values' content (rows or attributes) inside actually selected nodes.
QueryTemplatesSyntaxValues::valuesToStackBefore()
Injects markup from $values' content (rows or attributes) inside actually selected nodes.
QueryTemplatesSyntaxValues::valuesToStackPrepend()
Injects markup from $values' content (rows or attributes) inside actually selected nodes.
QueryTemplatesSyntaxValues::valuesToStackReplace()
Injects markup from $values' content (rows or attributes) inside actually selected nodes.
QueryTemplatesSyntaxValues::_valuesToLoop()
QueryTemplatesSyntaxValues::_valuesToStack()

Class: QueryTemplatesSyntaxDOM

QueryTemplatesSyntaxDOM::attrAppend()
QueryTemplatesSyntaxDOM::attrPrepend()
QueryTemplatesSyntaxDOM::stackToMethod()
Returns array being result of running $method on all stack elements.
QueryTemplatesSyntaxDOM::unWrap()
Removes selected element and moves it's children into parent node.

Class: phpQueryObject

phpQueryObject::__construct()
Enter description here...
phpQueryObject::add()
Enter description here...
phpQueryObject::addClass()
Enter description here...
phpQueryObject::addClassPHP()
Enter description here...
phpQueryObject::after()
Enter description here...
phpQueryObject::afterPHP()
Enter description here...
phpQueryObject::ancestors()
Enter description here...
phpQueryObject::andSelf()
Enter description here...
phpQueryObject::append()
Enter description here...
phpQueryObject::appendPHP()
Enter description here...
phpQueryObject::appendTo()
Enter description here...
phpQueryObject::attr()
phpQueryObject::attrEvents()
phpQueryObject::attrPHP()
Enter description here...
phpQueryObject::before()
Enter description here...
phpQueryObject::beforePHP()
Enter description here...
phpQueryObject::bind()
Binds a handler to one or more events (like click) for each matched element.
phpQueryObject::callback()
Run callback on actual object.
phpQueryObject::change()
Enter description here...
phpQueryObject::children()
Enter description here...
phpQueryObject::click()
Enter description here...
phpQueryObject::contents()
Enter description here...
phpQueryObject::contentsUnwrap()
Enter description here...
phpQueryObject::count()
phpQueryObject::css()
Enter description here...
phpQueryObject::current()
phpQueryObject::debug()
phpQueryObject::documentFragment()
phpQueryObject::dump()
Dump htmlOuter and preserve chain. Usefull for debugging.
phpQueryObject::dumpDie()
Dump htmlOuter and stop script execution. Usefull for debugging.
phpQueryObject::dumpLength()
phpQueryObject::dumpTree()
phpQueryObject::dumpWhois()
phpQueryObject::each()
Enter description here...
phpQueryObject::elementsContainsNode()
phpQueryObject::end()
Enter description here...
phpQueryObject::eq()
Enter description here...
phpQueryObject::extend()
Deprecated, use $pq->plugin() instead.
phpQueryObject::filter()
Enter description here...
phpQueryObject::filterCallback()
Enter description here...
phpQueryObject::find()
Enter description here...
phpQueryObject::get()
Return matched DOM nodes.
phpQueryObject::getDocument()
Returns object with stack set to document root.
phpQueryObject::getDocumentID()
Get object's Document ID.
phpQueryObject::getDocumentIDRef()
Saves object's DocumentID to $var by reference.
phpQueryObject::getDOMDocument()
phpQueryObject::getElementSiblings()
phpQueryObject::getNodeAttrs()
phpQueryObject::getNodeXpath()
Returns node's XPath.
phpQueryObject::getString()
Return matched DOM nodes.
phpQueryObject::getStrings()
Return matched DOM nodes.
phpQueryObject::hasClass()
Enter description here...
phpQueryObject::hide()
phpQueryObject::html()
Enter description here...
phpQueryObject::htmlOuter()
Enter description here...
phpQueryObject::index()
Enter description here...
phpQueryObject::insert()
Internal insert method. Don't use it.
phpQueryObject::insertAfter()
Enter description here...
phpQueryObject::insertBefore()
Enter description here...
phpQueryObject::is()
Enter description here...
phpQueryObject::isChar()
Determines if $char is really a char.
phpQueryObject::isHTML()
phpQueryObject::isRegexp()
phpQueryObject::isRoot()
phpQueryObject::isXHTML()
phpQueryObject::isXML()
phpQueryObject::key()
phpQueryObject::length()
Enter description here...
phpQueryObject::load()
Enter description here...
phpQueryObject::map()
Enter description here...
phpQueryObject::markup()
jQuey difference
phpQueryObject::markupEvents()
phpQueryObject::markupOuter()
jQuey difference
phpQueryObject::markupOuterPHP()
TODO doc
phpQueryObject::markupPHP()
TODO doc
phpQueryObject::matchClasses()
Enter description here...
phpQueryObject::merge()
phpQueryObject::newInstance()
Returns new instance of actual class.
phpQueryObject::next()
Double-function method.
phpQueryObject::nextAll()
phpQueryObject::not()
Enter description here...
phpQueryObject::offsetExists()
phpQueryObject::offsetGet()
phpQueryObject::offsetSet()
phpQueryObject::offsetUnset()
phpQueryObject::parent()
Enter description here...
phpQueryObject::parents()
Enter description here...
phpQueryObject::parseSelector()
phpQueryObject::php()
Just like html(), but returns markup with VALID (dangerous) PHP tags.
phpQueryObject::plugin()
Enter description here...
phpQueryObject::prepend()
Enter description here...
phpQueryObject::prependPHP()
Enter description here...
phpQueryObject::prependTo()
Enter description here...
phpQueryObject::prev()
Enter description here...
phpQueryObject::prevAll()
phpQueryObject::pseudoClasses()
phpQueryObject::remove()
Enter description here...
phpQueryObject::removeAttr()
Enter description here...
phpQueryObject::removeClass()
Enter description here...
phpQueryObject::replaceAll()
Enter description here...
phpQueryObject::replaceWith()
Enter description here...
phpQueryObject::replaceWithPHP()
Enter description here...
phpQueryObject::reverse()
Enter description here...
phpQueryObject::rewind()
phpQueryObject::runQuery()
phpQueryObject::serialize()
Enter description here...
phpQueryObject::serializeArray()
Enter description here...
phpQueryObject::show()
phpQueryObject::siblings()
Enter description here...
phpQueryObject::size()
Enter description here...
phpQueryObject::slice()
Enter description here...
phpQueryObject::stack()
Internal stack iterator.
phpQueryObject::stackIsRoot()
phpQueryObject::submit()
Enter description here...
phpQueryObject::switchWith()
Enter description here...
phpQueryObject::text()
Return joined text content.
phpQueryObject::toggleClass()
Enter description here...
phpQueryObject::toReference()
Saves actual object to $var by reference.
phpQueryObject::toRoot()
Enter description here...
phpQueryObject::trigger()
Trigger a type of event on every matched element.
phpQueryObject::triggerHandler()
This particular method triggers all bound event handlers on an element (for a specific event type) WITHOUT executing the browsers default actions.
phpQueryObject::unbind()
Enter description here...
phpQueryObject::unloadDocument()
Unloads whole document from memory.
phpQueryObject::unQuote()
phpQueryObject::val()
Return form element value.
phpQueryObject::valid()
phpQueryObject::whois()
phpQueryObject::wrap()
Enter description here...
phpQueryObject::wrapAll()
Enter description here...
phpQueryObject::wrapAllOld()
Enter description here...
phpQueryObject::wrapAllPHP()
Enter description here...
phpQueryObject::wrapInner()
Enter description here...
phpQueryObject::wrapInnerPHP()
Enter description here...
phpQueryObject::wrapPHP()
Enter description here...
phpQueryObject::xml()
phpQueryObject::xmlOuter()
phpQueryObject::_clone()
Enter description here...
phpQueryObject::_empty()
Proper name without underscore (just ->empty()) also works.
phpQueryObject::_next()
Safe rename of next().
phpQueryObject::_prev()
Use prev() and next().
phpQueryObject::__call()
phpQueryObject::__get()
phpQueryObject::__loadSuccess()
phpQueryObject::__pseudoClassParam()
phpQueryObject::__toString()
phpQueryObject::___wrapAllCallback()

Class Details

[line 11]
Class extending phpQueryObject with templating methods.



Tags:

author:  Tobiasz Cudnik <tobiasz.cudnik/gmail.com>
link:  http://code.google.com/p/querytemplates/
abstract:  
license:  MIT License


[ Top ]


Class Methods


method codeToSelector [line 87]

QueryTemplatesParse|QueryTemplatesPhpQuery codeToSelector( String $codeArray, [String $selectorPattern = '.%k'], [Array $skipFields = null], [Callback|string $fieldCallback = null])

Injects raw executable code inside nodes matched by selector. Method uses actually matched nodes as root for the query.

Method doesn't change selected elements stack.

== Example ==

=== Markup ===

  1.  <class='field1'>lorem ipsum</p>
  2.  <class='field2'>lorem ipsum</p>

=== Data ===

  1.  $code array(
  2.      'field1' => 'print "abba";',
  3.      'field2' => 'foreach(array(1, 2, 3) as $i) print $i'
  4.  );

=== `QueryTemplates` formula ===

  1.  $template->
  2.      codeToSelector($code)
  3.  ;

=== Template ===

  1.  <p class="field1"><?php  print "abba";  ?></p>
  2.  <p class="field2"><?php  foreach(array(123as $iprint $i  ?></p>

=== Template tree before ===

  1.  p.field1
  2.   - Text:lorem ipsum
  3.  p.field2
  4.   - Text:lorem ipsum

=== Template tree after ===

  1.  p.field1
  2.   - PHP
  3.  p.field2
  4.   - PHP




Tags:

see:  QueryTemplatesPhpQuery::varsToStack()
access:  public


Parameters:

String   $codeArray   Array of raw code, where key is the field.
String   $selectorPattern   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   $skipFields   Array of keys from $varValue which should be skipped.
Callback|string   $fieldCallback   Callback triggered after every insertion. Three parameters are passed to this callback:
  • $node phpQueryObject
  • $field String
  • $target String|array

[ Top ]

method codeToSelectorAfter [line 408]

QueryTemplatesParse|QueryTemplatesPhpQuery codeToSelectorAfter( String $codeArray, [String $selectorPattern = '.%k'], [Array $skipFields = null], [Callback|string $fieldCallback = null])

Injects raw executable code after nodes matched by selector. Method uses actually matched nodes as root for the query.

Method doesn't change selected elements stack.

== Example ==

=== Markup ===

  1.  <class='field1'>lorem ipsum</p>
  2.  <class='field2'>lorem ipsum</p>

=== Data ===

  1.  $code array(
  2.      'field1' => 'print "abba";',
  3.      'field2' => 'foreach(array(1, 2, 3) as $i) print $i'
  4.  );

=== `QueryTemplates` formula ===

  1.  $template->
  2.      codeToSelectorAfter($code)
  3.  ;

=== Template ===

  1.  <p class="field1">lorem ipsum</p>
  2.  <?php  print "abba";  ?>
  3.  <p class="field2">lorem ipsum</p>
  4.  <?php  foreach(array(123as $iprint $i  ?>

=== Template tree before ===

  1.  p.field1
  2.   - Text:lorem ipsum
  3.  p.field2
  4.   - Text:lorem ipsum

=== Template tree after ===

  1.  p.field1
  2.   - Text:lorem ipsum
  3.  PHP
  4.  p.field2
  5.   - Text:lorem ipsum
  6.  PHP




Tags:

see:  QueryTemplatesPhpQuery::varsToStack()
access:  public


Parameters:

String   $codeArray   Array of raw code, where key is the field.
String   $selectorPattern   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   $skipFields   Array of keys from $varValue which should be skipped.
Callback|string   $fieldCallback   Callback triggered after every insertion. Three parameters are passed to this callback:
  • $node phpQueryObject
  • $field String
  • $target String|array

[ Top ]

method codeToSelectorAppend [line 246]

QueryTemplatesParse|QueryTemplatesPhpQuery codeToSelectorAppend( String $codeArray, [String $selectorPattern = '.%k'], [Array $skipFields = null], [Callback|string $fieldCallback = null], String $attr)

Injects 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.

== Example ==

=== Markup ===

  1.  <class='field1'>lorem ipsum</p>
  2.  <class='field2'>lorem ipsum</p>

=== Data ===

  1.  $code array(
  2.      'field1' => 'print "abba";',
  3.      'field2' => 'foreach(array(1, 2, 3) as $i) print $i'
  4.  );

=== `QueryTemplates` formula ===

  1.  $template->
  2.      codeToSelectorAppend($code)
  3.  ;

=== Template ===

  1.  <p class="field1">lorem ipsum<?php  print "abba";  ?></p>
  2.  <p class="field2">lorem ipsum<?php  foreach(array(123as $iprint $i  ?></p>

=== Template tree before ===

  1.  p.field1
  2.   - Text:lorem ipsum
  3.  p.field2
  4.   - Text:lorem ipsum

=== Template tree after ===

  1.  p.field1
  2.   - Text:lorem ipsum
  3.   - PHP
  4.  p.field2
  5.   - Text:lorem ipsum
  6.   - PHP




Tags:

see:  QueryTemplatesPhpQuery::varsToStack()
access:  public


Parameters:

String   $attr   Target attribute name.
String   $codeArray   Array of raw code, where key is the field.
String   $selectorPattern   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   $skipFields   Array of keys from $varValue which should be skipped.
Callback|string   $fieldCallback   Callback triggered after every insertion. Three parameters are passed to this callback:
  • $node phpQueryObject
  • $field String
  • $target String|array

[ Top ]

method codeToSelectorAttr [line 569]

QueryTemplatesParse|QueryTemplatesPhpQuery codeToSelectorAttr( String $attr, String $codeArray, [String $selectorPattern = '.%k'], [Array $skipFields = null], [Callback|string $fieldCallback = null])

Injects raw executable code inside 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 ===

  1.  <class='field1'>lorem ipsum</p>
  2.  <class='field2'>lorem ipsum</p>

=== Data ===

  1.  $code array(
  2.      'field1' => 'print "abba";',
  3.      'field2' => 'foreach(array(1, 2, 3) as $i) print $i'
  4.  );

=== `QueryTemplates` formula ===

  1.  $template->
  2.      codeToSelectorAttr('rel'$code)
  3.  ;

=== Template ===

  1.  <p class="field1" rel='<?php  print "abba";  ?>'>lorem ipsum</p>
  2.  <p class="field2" rel="<?php  foreach(array(123as $iprint $i  ?>">lorem ipsum</p>

=== Template tree before ===

  1.  p.field1
  2.   - Text:lorem ipsum
  3.  p.field2
  4.   - Text:lorem ipsum

=== Template tree after ===

  1.  p.field1
  2.   - Text:lorem ipsum
  3.  p.field2
  4.   - Text:lorem ipsum




Tags:

see:  QueryTemplatesPhpQuery::varsToStack()
access:  public


Parameters:

String   $attr   Target attribute name.
String   $codeArray   Array of raw code, where key is the field.
String   $selectorPattern   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   $skipFields   Array of keys from $varValue which should be skipped.
Callback|string   $fieldCallback   Callback triggered after every insertion. Three parameters are passed to this callback:
  • $node phpQueryObject
  • $field String
  • $target String|array

[ Top ]

method codeToSelectorBefore [line 488]

QueryTemplatesParse|QueryTemplatesPhpQuery codeToSelectorBefore( String $codeArray, [String $selectorPattern = '.%k'], [Array $skipFields = null], [Callback|string $fieldCallback = null])

Injects raw executable code before nodes matched by selector. Method uses actually matched nodes as root for the query.

Method doesn't change selected elements stack.

== Example ==

=== Markup ===

  1.  <class='field1'>lorem ipsum</p>
  2.  <class='field2'>lorem ipsum</p>

=== Data ===

  1.  $code array(
  2.      'field1' => 'print "abba";',
  3.      'field2' => 'foreach(array(1, 2, 3) as $i) print $i'
  4.  );

=== `QueryTemplates` formula ===

  1.  $template->
  2.      codeToSelectorBefore($code)
  3.  ;

=== Template ===

  1.  <?php  print "abba";  ?><p class="field1">lorem ipsum</p>
  2.  <?php  foreach(array(123as $iprint $i  ?><p class="field2">lorem ipsum</p>

=== Template tree before ===

  1.  p.field1
  2.   - Text:lorem ipsum
  3.  p.field2
  4.   - Text:lorem ipsum

=== Template tree after ===

  1.  PHP
  2.  p.field1
  3.   - Text:lorem ipsum
  4.  PHP
  5.  p.field2
  6.   - Text:lorem ipsum




Tags:

see:  QueryTemplatesPhpQuery::varsToStack()
access:  public


Parameters:

String   $codeArray   Array of raw code, where key is the field.
String   $selectorPattern   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   $skipFields   Array of keys from $varValue which should be skipped.
Callback|string   $fieldCallback   Callback triggered after every insertion. Three parameters are passed to this callback:
  • $node phpQueryObject
  • $field String
  • $target String|array

[ Top ]

method codeToSelectorPrepend [line 326]

QueryTemplatesParse|QueryTemplatesPhpQuery codeToSelectorPrepend( String $codeArray, [String $selectorPattern = '.%k'], [Array $skipFields = null], [Callback|string $fieldCallback = null])

Injects raw executable code at the beggining of nodes matched by selector.

Method uses actually matched nodes as root for the query.

Method doesn't change selected elements stack.

== Example ==

=== Markup ===

  1.  <class='field1'>lorem ipsum</p>
  2.  <class='field2'>lorem ipsum</p>

=== Data ===

  1.  $code array(
  2.      'field1' => 'print "abba";',
  3.      'field2' => 'foreach(array(1, 2, 3) as $i) print $i'
  4.  );

=== `QueryTemplates` formula ===

  1.  $template->
  2.      codeToSelectorPrepend($code)
  3.  ;

=== Template ===

  1.  <p class="field1"><?php  print "abba";  ?>lorem ipsum</p>
  2.  <p class="field2"><?php  foreach(array(123as $iprint $i  ?>lorem ipsum</p>

=== Template tree before ===

  1.  p.field1
  2.   - Text:lorem ipsum
  3.  p.field2
  4.   - Text:lorem ipsum

=== Template tree after ===

  1.  p.field1
  2.   - PHP
  3.   - Text:lorem ipsum
  4.  p.field2
  5.   - PHP
  6.   - Text:lorem ipsum




Tags:

see:  QueryTemplatesPhpQuery::varsToStack()
access:  public


Parameters:

String   $codeArray   Array of raw code, where key is the field.
String   $selectorPattern   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   $skipFields   Array of keys from $varValue which should be skipped.
Callback|string   $fieldCallback   Callback triggered after every insertion. Three parameters are passed to this callback:
  • $node phpQueryObject
  • $field String
  • $target String|array

[ Top ]

method codeToSelectorReplace [line 163]

QueryTemplatesParse|QueryTemplatesPhpQuery codeToSelectorReplace( String $codeArray, [String $selectorPattern = '.%k'], [Array $skipFields = null], [Callback|string $fieldCallback = null])

Injects raw executable code replacing nodes matched by selector. Method uses actually matched nodes as root for the query.

Method doesn't change selected elements stack.

== Example ==

=== Markup ===

  1.  <class='field1'>lorem ipsum</p>
  2.  <class='field2'>lorem ipsum</p>

=== Data ===

  1.  $code array(
  2.      'field1' => 'print "abba";',
  3.      'field2' => 'foreach(array(1, 2, 3) as $i) print $i'
  4.  );

=== `QueryTemplates` formula ===

  1.  $template->
  2.      codeToSelectorReplace($code)
  3.  ;

=== Template ===

  1.  <?php  print "abba";  ?>
  2.  <?php  foreach(array(123as $iprint $i  ?>

=== Template tree before ===

  1.  p.field1
  2.   - Text:lorem ipsum
  3.  p.field2
  4.   - Text:lorem ipsum

=== Template tree after ===

  1.  PHP
  2.  PHP




Tags:

see:  QueryTemplatesPhpQuery::varsToStack()
access:  public


Parameters:

String   $codeArray   Array of raw code, where key is the field.
String   $selectorPattern   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   $skipFields   Array of keys from $varValue which should be skipped.
Callback|string   $fieldCallback   Callback triggered after every insertion. Three parameters are passed to this callback:
  • $node phpQueryObject
  • $field String
  • $target String|array

[ Top ]

method codeToStack [line 664]

QueryTemplatesParse|QueryTemplatesPhpQuery codeToStack( String $codeArray, [ $selectorPattern = '.%k'], [Array $skipFields = null], [Callback|string $fieldCallback = null])

Injects raw executable code inside actually matched nodes.

Method doesn't change selected elements stack.

== Example ==

=== Markup ===

  1.  <node1>
  2.    <node2/>
  3.  </node1>
  4.  <node2/>
  5.  <node1>
  6.    <node2/>
  7.  </node1>

=== Data ===

  1.  $code array(
  2.      'print "abba";',
  3.      'foreach(array(1, 2, 3) as $i) print $i'
  4.  );

=== `QueryTemplates` formula ===

  1.  $template->
  2.      codeToStack($code)
  3.  ;

=== Template ===

  1.  <?php  print "abba";  ?>

=== Template tree before ===

  1.  node1
  2.   - node2
  3.  node2
  4.  node1
  5.   - node2

=== Template tree after ===

  1.  PHP




Tags:

see:  QueryTemplatesPhpQuery::codeToSelector()
access:  public


Parameters:

String   $codeArray   Array of raw code, where key is the field.
Array   $skipFields   Array of fields from $codeArray which should be skipped.
Callback|string   $fieldCallback   Callback triggered after every insertion. Three parameters are passed to this callback:
  • $node phpQueryObject
  • $field String
  • $target String|array
   $selectorPattern  

[ Top ]

method codeToStackAfter [line 971]

QueryTemplatesParse|QueryTemplatesPhpQuery codeToStackAfter( String $codeArray, [ $selectorPattern = '.%k'], [Array $skipFields = null], [Callback|string $fieldCallback = null])

Injects raw executable code after actually matched nodes.

Method doesn't change selected elements stack.

== Example ==

=== Markup ===

  1.  <node1>
  2.    <node2/>
  3.  </node1>
  4.  <node2/>
  5.  <node1>
  6.    <node2/>
  7.  </node1>

=== Data ===

  1.  $code array(
  2.      'print "abba";',
  3.      'foreach(array(1, 2, 3) as $i) print $i'
  4.  );

=== `QueryTemplates` formula ===

  1.  $template->
  2.      codeToStackAfter($code)
  3.  ;

=== Template ===

  1.  <node1><node2></node2></node1><node2></node2><node1><node2></node2></node1>

=== Template tree before ===

  1.  node1
  2.   - node2
  3.  node2
  4.  node1
  5.   - node2

=== Template tree after ===

  1.  node1
  2.   - node2
  3.  node2
  4.  node1
  5.   - node2




Tags:

see:  QueryTemplatesPhpQuery::codeToSelector()
access:  public


Parameters:

String   $codeArray   Array of raw code, where key is the field.
Array   $skipFields   Array of fields from $codeArray which should be skipped.
Callback|string   $fieldCallback   Callback triggered after every insertion. Three parameters are passed to this callback:
  • $node phpQueryObject
  • $field String
  • $target String|array
   $selectorPattern  

[ Top ]

method codeToStackAppend [line 817]

QueryTemplatesParse|QueryTemplatesPhpQuery codeToStackAppend( String $codeArray, [ $selectorPattern = '.%k'], [Array $skipFields = null], [Callback|string $fieldCallback = null])

Injects raw executable code at the beggining of actually matched nodes.

Method doesn't change selected elements stack.

== Example ==

=== Markup ===

  1.  <node1>
  2.    <node2/>
  3.  </node1>
  4.  <node2/>
  5.  <node1>
  6.    <node2/>
  7.  </node1>

=== Data ===

  1.  $code array(
  2.      'print "abba";',
  3.      'foreach(array(1, 2, 3) as $i) print $i'
  4.  );

=== `QueryTemplates` formula ===

  1.  $template->
  2.      codeToStackAppend($code)
  3.  ;

=== Template ===

  1.  <node1><node2></node2></node1><node2></node2><node1><node2></node2></node1><?php  print "abba";  ?>

=== Template tree before ===

  1.  node1
  2.   - node2
  3.  node2
  4.  node1
  5.   - node2

=== Template tree after ===

  1.  node1
  2.   - node2
  3.  node2
  4.  node1
  5.   - node2
  6.  PHP




Tags:

see:  QueryTemplatesPhpQuery::codeToSelector()
access:  public


Parameters:

String   $codeArray   Array of raw code, where key is the field.
Array   $skipFields   Array of fields from $codeArray which should be skipped.
Callback|string   $fieldCallback   Callback triggered after every insertion. Three parameters are passed to this callback:
  • $node phpQueryObject
  • $field String
  • $target String|array
   $selectorPattern  

[ Top ]

method codeToStackAttr [line 1126]

QueryTemplatesParse|QueryTemplatesPhpQuery codeToStackAttr( String $attr, String $codeArray, [ $selectorPattern = '.%k'], [Array $skipFields = null], [Callback|string $fieldCallback = null])

Injects raw executable code inside attribute of actually matched nodes.

Method doesn't change selected elements stack.

== Example ==

=== Markup ===

  1.  <node1>
  2.    <node2/>
  3.  </node1>
  4.  <node2/>
  5.  <node1>
  6.    <node2/>
  7.  </node1>

=== Data ===

  1.  $code array(
  2.      'print "abba";',
  3.      'foreach(array(1, 2, 3) as $i) print $i'
  4.  );

=== `QueryTemplates` formula ===

  1.  $template->
  2.      codeToStackAttr('rel'$code)
  3.  ;

=== Template ===

  1.  <node1><node2></node2></node1><node2></node2><node1><node2></node2></node1>

=== Template tree before ===

  1.  node1
  2.   - node2
  3.  node2
  4.  node1
  5.   - node2

=== Template tree after ===

  1.  node1
  2.   - node2
  3.  node2
  4.  node1
  5.   - node2




Tags:

see:  QueryTemplatesPhpQuery::codeToSelector()
access:  public


Parameters:

String   $attr   Target attribute name.
String   $codeArray   Array of raw code, where key is the field.
Array   $skipFields   Array of fields from $codeArray which should be skipped.
Callback|string   $fieldCallback   Callback triggered after every insertion. Three parameters are passed to this callback:
  • $node phpQueryObject
  • $field String
  • $target String|array
   $selectorPattern  

[ Top ]

method codeToStackBefore [line 1047]

QueryTemplatesParse|QueryTemplatesPhpQuery codeToStackBefore( String $codeArray, [ $selectorPattern = '.%k'], [Array $skipFields = null], [Callback|string $fieldCallback = null])

Injects raw executable code before actually matched nodes.

Method doesn't change selected elements stack.

== Example ==

=== Markup ===

  1.  <node1>
  2.    <node2/>
  3.  </node1>
  4.  <node2/>
  5.  <node1>
  6.    <node2/>
  7.  </node1>

=== Data ===

  1.  $code array(
  2.      'print "abba";',
  3.      'foreach(array(1, 2, 3) as $i) print $i'
  4.  );

=== `QueryTemplates` formula ===

  1.  $template->
  2.      codeToStackBefore($code)
  3.  ;

=== Template ===

  1.  <node1><node2></node2></node1><node2></node2><node1><node2></node2></node1>

=== Template tree before ===

  1.  node1
  2.   - node2
  3.  node2
  4.  node1
  5.   - node2

=== Template tree after ===

  1.  node1
  2.   - node2
  3.  node2
  4.  node1
  5.   - node2




Tags:

see:  QueryTemplatesPhpQuery::codeToSelector()
access:  public


Parameters:

String   $codeArray   Array of raw code, where key is the field.
Array   $skipFields   Array of fields from $codeArray which should be skipped.
Callback|string   $fieldCallback   Callback triggered after every insertion. Three parameters are passed to this callback:
  • $node phpQueryObject
  • $field String
  • $target String|array
   $selectorPattern  

[ Top ]

method codeToStackPrepend [line 895]

QueryTemplatesParse|QueryTemplatesPhpQuery codeToStackPrepend( String $codeArray, [ $selectorPattern = '.%k'], [Array $skipFields = null], [Callback|string $fieldCallback = null])

Injects raw executable code at the end of actually matched nodes.

Method doesn't change selected elements stack.

== Example ==

=== Markup ===

  1.  <node1>
  2.    <node2/>
  3.  </node1>
  4.  <node2/>
  5.  <node1>
  6.    <node2/>
  7.  </node1>

=== Data ===

  1.  $code array(
  2.      'print "abba";',
  3.      'foreach(array(1, 2, 3) as $i) print $i'
  4.  );

=== `QueryTemplates` formula ===

  1.  $template->
  2.      codeToStackPrepend($code)
  3.  ;

=== Template ===

  1.  <?php  print "abba";  ?>
  2.  <node1><node2></node2></node1><node2></node2><node1><node2></node2></node1>

=== Template tree before ===

  1.  node1
  2.   - node2
  3.  node2
  4.  node1
  5.   - node2

=== Template tree after ===

  1.  PHP
  2.  node1
  3.   - node2
  4.  node2
  5.  node1
  6.   - node2




Tags:

see:  QueryTemplatesPhpQuery::codeToSelector()
access:  public


Parameters:

String   $codeArray   Array of raw code, where key is the field.
Array   $skipFields   Array of fields from $codeArray which should be skipped.
Callback|string   $fieldCallback   Callback triggered after every insertion. Three parameters are passed to this callback:
  • $node phpQueryObject
  • $field String
  • $target String|array
   $selectorPattern  

[ Top ]

method codeToStackReplace [line 740]

QueryTemplatesParse|QueryTemplatesPhpQuery codeToStackReplace( String $codeArray, [ $selectorPattern = '.%k'], [Array $skipFields = null], [Callback|string $fieldCallback = null])

Injects raw executable code replacing actually matched nodes.

Method doesn't change selected elements stack.

== Example ==

=== Markup ===

  1.  <node1>
  2.    <node2/>
  3.  </node1>
  4.  <node2/>
  5.  <node1>
  6.    <node2/>
  7.  </node1>

=== Data ===

  1.  $code array(
  2.      'print "abba";',
  3.      'foreach(array(1, 2, 3) as $i) print $i'
  4.  );

=== `QueryTemplates` formula ===

  1.  $template->
  2.      codeToStackReplace($code)
  3.  ;

=== Template ===

  1.  <node1><node2></node2></node1><node2></node2><node1><node2></node2></node1>

=== Template tree before ===

  1.  node1
  2.   - node2
  3.  node2
  4.  node1
  5.   - node2

=== Template tree after ===

  1.  node1
  2.   - node2
  3.  node2
  4.  node1
  5.   - node2




Tags:

see:  QueryTemplatesPhpQuery::codeToSelector()
access:  public


Parameters:

String   $codeArray   Array of raw code, where key is the field.
Array   $skipFields   Array of fields from $codeArray which should be skipped.
Callback|string   $fieldCallback   Callback triggered after every insertion. Three parameters are passed to this callback:
  • $node phpQueryObject
  • $field String
  • $target String|array
   $selectorPattern  

[ Top ]

method _codeToSelector [line 572]

void _codeToSelector( $target, $codeArray, $selectorPattern, $skipFields, $fieldCallback)



Tags:

access:  protected


Parameters:

   $target  
   $codeArray  
   $selectorPattern  
   $skipFields  
   $fieldCallback  

[ Top ]

method _codeToStack [line 1129]

void _codeToStack( $target, $codeArray, $selectorPattern, $skipFields, $fieldCallback)



Tags:

access:  protected


Parameters:

   $target  
   $codeArray  
   $selectorPattern  
   $skipFields  
   $fieldCallback  

[ Top ]


Documentation generated on Sat, 07 Mar 2009 12:08:18 +0100 by phpDocumentor 1.4.2