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

Class: QueryTemplatesSyntaxVars

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

Class Overview

phpQueryObject
   |
   --QueryTemplatesSyntaxDOM
      |
      --QueryTemplatesSyntaxValues
         |
         --QueryTemplatesSyntaxCode
            |
            --QueryTemplatesSyntaxConditions
               |
               --QueryTemplatesSyntaxVars

Class extending phpQueryObject with templating methods.


Author(s):

Methods


Child classes:

QueryTemplatesSyntaxGenerators
Class extending phpQueryObject with templating methods.

Inherited Variables

Inherited Methods

Class: QueryTemplatesSyntaxConditions

QueryTemplatesSyntaxConditions::elseIfCode()
QueryTemplatesSyntaxConditions::elseIfNotVar()
Wraps selected tag with PHP "else if" statement checking if $var evaluates to FALSE. $var must be available inside template's scope.
QueryTemplatesSyntaxConditions::elseIfPHP()
Wraps selected tag with PHP "else if" statement containing $code as condition.
QueryTemplatesSyntaxConditions::elseIfVar()
Wraps selected tag with PHP "else if" statement checking if $var evaluates to true. $var must be available inside template's scope.
QueryTemplatesSyntaxConditions::elsePHP()
Wraps selected tag with PHP "else" statement.
QueryTemplatesSyntaxConditions::elseStatement()
TODO description
QueryTemplatesSyntaxConditions::endOnly()
TODO docs
QueryTemplatesSyntaxConditions::ifCode()
TODO doc
QueryTemplatesSyntaxConditions::ifNotVar()
Wraps selected tag with PHP "if" statement checking if $var evaluates to FALSE. $var must be available inside template's scope.
QueryTemplatesSyntaxConditions::ifPHP()
Wraps selected tag with PHP "if" statement containing $code as condition.
QueryTemplatesSyntaxConditions::ifVar()
Wraps selected tag with PHP "if" statement checking if $var evaluates to TRUE. $var must be available inside template's scope.
QueryTemplatesSyntaxConditions::onlyIf()
TODO docs
QueryTemplatesSyntaxConditions::onlyIfNot()
TODO docs
QueryTemplatesSyntaxConditions::onlyJS()
TODO Move to jsCode plugin.
QueryTemplatesSyntaxConditions::onlyPHP()
Honors code between onlyPHP and endOnly, only for PHP templates.
QueryTemplatesSyntaxConditions::tagToElseIfNotVar()
Replaces selected tag with PHP "else if" statement checking if $var evaluates to FALSE. $var must be available inside template's scope.
QueryTemplatesSyntaxConditions::tagToElseIfPHP()
Replaces selected tag with PHP "else if" statement containing $code as condition.
QueryTemplatesSyntaxConditions::tagToElseIfVar()
Replaces selected tag with PHP "else if" statement checking if $var evaluates to TRUE. $var must be available inside template's scope.
QueryTemplatesSyntaxConditions::tagToElsePHP()
QueryTemplatesSyntaxConditions::tagToElseStatement()
QueryTemplatesSyntaxConditions::tagToIfNotVar()
Replaces selected tag with PHP "if" statement checking if $var evaluates to FALSE. $var must be available inside template's scope.
QueryTemplatesSyntaxConditions::tagToIfPHP()
Replaces selected tag with PHP "if" statement containing $code as condition.
QueryTemplatesSyntaxConditions::tagToIfVar()
Replaces selected tag with PHP "if" statement checking if $var evaluates to TRUE. $var must be available inside template's scope.
QueryTemplatesSyntaxConditions::_if()
QueryTemplatesSyntaxConditions::_tagToElse()

Class: QueryTemplatesSyntaxCode

QueryTemplatesSyntaxCode::codeToSelector()
Injects raw executable code inside nodes matched by selector. Method uses actually matched nodes as root for the query.
QueryTemplatesSyntaxCode::codeToSelectorAfter()
Injects raw executable code after nodes matched by selector. Method uses actually matched nodes as root for the query.
QueryTemplatesSyntaxCode::codeToSelectorAppend()
Injects raw executable code at the end of nodes matched by selector. Method uses actually matched nodes as root for the query.
QueryTemplatesSyntaxCode::codeToSelectorAttr()
Injects raw executable code inside attribute of nodes matched by selector.
QueryTemplatesSyntaxCode::codeToSelectorBefore()
Injects raw executable code before nodes matched by selector. Method uses actually matched nodes as root for the query.
QueryTemplatesSyntaxCode::codeToSelectorPrepend()
Injects raw executable code at the beggining of nodes matched by selector.
QueryTemplatesSyntaxCode::codeToSelectorReplace()
Injects raw executable code replacing nodes matched by selector. Method uses actually matched nodes as root for the query.
QueryTemplatesSyntaxCode::codeToStack()
Injects raw executable code inside actually matched nodes.
QueryTemplatesSyntaxCode::codeToStackAfter()
Injects raw executable code after actually matched nodes.
QueryTemplatesSyntaxCode::codeToStackAppend()
Injects raw executable code at the beggining of actually matched nodes.
QueryTemplatesSyntaxCode::codeToStackAttr()
Injects raw executable code inside attribute of actually matched nodes.
QueryTemplatesSyntaxCode::codeToStackBefore()
Injects raw executable code before actually matched nodes.
QueryTemplatesSyntaxCode::codeToStackPrepend()
Injects raw executable code at the end of actually matched nodes.
QueryTemplatesSyntaxCode::codeToStackReplace()
Injects raw executable code replacing actually matched nodes.
QueryTemplatesSyntaxCode::_codeToSelector()
QueryTemplatesSyntaxCode::_codeToStack()

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 loop [line 2546]

unknown_type loop( $varName $varName, $asVarName $asVarName, [$keyName $keyName = null])



Tags:

deprecated:  use varsToLoop
access:  public


Parameters:

$varName   $varName  
$asVarName   $asVarName  
$keyName   $keyName  

[ Top ]

method loopOne [line 2536]

unknown_type loopOne( $varName $varName, $asVarName $asVarName, [$keyName $keyName = null])



Tags:

deprecated:  use varsToLoopFirst
access:  public


Parameters:

$varName   $varName  
$asVarName   $asVarName  
$keyName   $keyName  

[ Top ]

method loopSeparate [line 2526]

unknown_type loopSeparate( $varName $varName, $asVarName $asVarName, [$keyName $keyName = null])



Tags:

deprecated:  use varsToLoopSeparate
access:  public


Parameters:

$varName   $varName  
$asVarName   $asVarName  
$keyName   $keyName  

[ Top ]

method valuesToSelector [line 1821]

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

Injects markup from $values' content (rows or attributes) into 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.  $values array(
  2.      'field1' => '<foo/>',
  3.      'field2' => '<bar/>'
  4.  );

=== `QueryTemplates` formula ===

  1.  $template->
  2.      valuesToSelector($values)
  3.  ;

=== Template ===

  1.  <class="field1"><foo></foo></p>
  2.  <class="field2"><bar></bar></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.   - foo
  3.  p.field2
  4.   - bar




Tags:

see:  QueryTemplatesPhpQuery::valuesToStack()
see:  QueryTemplatesPhpQuery::valuesToForm()
access:  public


Parameters:

Array|Object   $values   Associative array or Object containing markup, text or instance of Callback.
String   $selectorPattern   Defines pattern matching target nodes. %k represents key. Defaults to ".%k", which matches nodes with class name equivalent to data source key. For example, to restrict match to nodes with additional class "foo" change $selectorPattern to ".foo.%k"
Array   $skipFields   Array of fields from $values 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 valuesToSelectorAfter [line 2065]

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

Injects markup from $values' content (rows or attributes) 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.  $values array(
  2.      'field1' => '<foo/>',
  3.      'field2' => '<bar/>'
  4.  );

=== `QueryTemplates` formula ===

  1.  $template->
  2.      valuesToSelectorAfter($values)
  3.  ;

=== Template ===

  1.  <class="field1">lorem ipsum</p>
  2.  <foo></foo>
  3.  <class="field2">lorem ipsum</p>
  4.  <bar></bar>

=== 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.  foo
  4.  p.field2
  5.   - Text:lorem ipsum
  6.  bar




Tags:

see:  QueryTemplatesPhpQuery::valuesToStack()
see:  QueryTemplatesPhpQuery::valuesToForm()
access:  public


Parameters:

Array|Object   $values   Associative array or Object containing markup, text or instance of Callback.
String   $selectorPattern   Defines pattern matching target nodes. %k represents key. Defaults to ".%k", which matches nodes with class name equivalent to data source key. For example, to restrict match to nodes with additional class "foo" change $selectorPattern to ".foo.%k"
Array   $skipFields   Array of fields from $values 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 valuesToSelectorAppend [line 2229]

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

Injects markup from $values' content (rows or attributes) 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.  $values array(
  2.      'field1' => '<foo/>',
  3.      'field2' => '<bar/>'
  4.  );

=== `QueryTemplates` formula ===

  1.  $template->
  2.      valuesToSelectorAppend($values)
  3.  ;

=== Template ===

  1.  <class="field1">lorem ipsum<foo></foo></p>
  2.  <class="field2">lorem ipsum<bar></bar></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.   - foo
  4.  p.field2
  5.   - Text:lorem ipsum
  6.   - bar




Tags:

see:  QueryTemplatesPhpQuery::valuesToStack()
see:  QueryTemplatesPhpQuery::valuesToForm()
access:  public


Parameters:

Array|Object   $values   Associative array or Object containing markup, text or instance of Callback.
String   $selectorPattern   Defines pattern matching target nodes. %k represents key. Defaults to ".%k", which matches nodes with class name equivalent to data source key. For example, to restrict match to nodes with additional class "foo" change $selectorPattern to ".foo.%k"
Array   $skipFields   Array of fields from $values 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 valuesToSelectorAttr [line 2312]

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

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 ===

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

=== Data ===

  1.  $values array(
  2.      'field1' => '<foo/>',
  3.      'field2' => '<bar/>'
  4.  );

=== `QueryTemplates` formula ===

  1.  $template->
  2.      valuesToSelectorAttr('rel'$values)
  3.  ;

=== Template ===

  1.  <class="field1" rel="&lt;foo/&gt;">lorem ipsum</p>
  2.  <class="field2" rel="&lt;bar/&gt;">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::valuesToStack()
see:  QueryTemplatesPhpQuery::valuesToForm()
access:  public


Parameters:

String   $attr   Target attribute name.
Array|Object   $values   Associative array or Object containing markup, text or instance of Callback.
String   $selectorPattern   Defines pattern matching target nodes. %k represents key. Defaults to ".%k", which matches nodes with class name equivalent to data source key. For example, to restrict match to nodes with additional class "foo" change $selectorPattern to ".foo.%k"
Array   $skipFields   Array of fields from $values 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 valuesToSelectorBefore [line 1981]

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

Injects markup from $values' content (rows or attributes) 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.  $values array(
  2.      'field1' => '<foo/>',
  3.      'field2' => '<bar/>'
  4.  );

=== `QueryTemplates` formula ===

  1.  $template->
  2.      valuesToSelectorBefore($values)
  3.  ;

=== Template ===

  1.  <foo></foo><class="field1">lorem ipsum</p>
  2.  <bar></bar><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.  foo
  2.  p.field1
  3.   - Text:lorem ipsum
  4.  bar
  5.  p.field2
  6.   - Text:lorem ipsum




Tags:

see:  QueryTemplatesPhpQuery::valuesToStack()
see:  QueryTemplatesPhpQuery::valuesToForm()
access:  public


Parameters:

Array|Object   $values   Associative array or Object containing markup, text or instance of Callback.
String   $selectorPattern   Defines pattern matching target nodes. %k represents key. Defaults to ".%k", which matches nodes with class name equivalent to data source key. For example, to restrict match to nodes with additional class "foo" change $selectorPattern to ".foo.%k"
Array   $skipFields   Array of fields from $values 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 valuesToSelectorPrepend [line 2147]

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

Injects markup from $values' content (rows or attributes) 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.  $values array(
  2.      'field1' => '<foo/>',
  3.      'field2' => '<bar/>'
  4.  );

=== `QueryTemplates` formula ===

  1.  $template->
  2.      valuesToSelectorPrepend($values)
  3.  ;

=== Template ===

  1.  <class="field1"><foo></foo>lorem ipsum</p>
  2.  <class="field2"><bar></bar>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.   - foo
  3.   - Text:lorem ipsum
  4.  p.field2
  5.   - bar
  6.   - Text:lorem ipsum




Tags:

see:  QueryTemplatesPhpQuery::valuesToStack()
see:  QueryTemplatesPhpQuery::valuesToForm()
access:  public


Parameters:

Array|Object   $values   Associative array or Object containing markup, text or instance of Callback.
String   $selectorPattern   Defines pattern matching target nodes. %k represents key. Defaults to ".%k", which matches nodes with class name equivalent to data source key. For example, to restrict match to nodes with additional class "foo" change $selectorPattern to ".foo.%k"
Array   $skipFields   Array of fields from $values 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 valuesToSelectorReplace [line 1899]

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

Injects markup from $values' content (rows or attributes) 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.  $values array(
  2.      'field1' => '<foo/>',
  3.      'field2' => '<bar/>'
  4.  );

=== `QueryTemplates` formula ===

  1.  $template->
  2.      valuesToSelectorReplace($values)
  3.  ;

=== Template ===

  1.  <foo></foo>
  2.  <bar></bar>

=== Template tree before ===

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

=== Template tree after ===

  1.  foo
  2.  bar




Tags:

see:  QueryTemplatesPhpQuery::valuesToStack()
see:  QueryTemplatesPhpQuery::valuesToForm()
access:  public


Parameters:

Array|Object   $values   Associative array or Object containing markup, text or instance of Callback.
String   $selectorPattern   Defines pattern matching target nodes. %k represents key. Defaults to ".%k", which matches nodes with class name equivalent to data source key. For example, to restrict match to nodes with additional class "foo" change $selectorPattern to ".foo.%k"
Array   $skipFields   Array of fields from $values 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 varPrint [line 68]

QueryTemplatesPhpQuery|QueryTemplatesParse varPrint( String $varName)

Prints variable $varName as matched elements' content.

== Example ==

=== Markup ===

  1.  <div>
  2.      <p>FOO</p>
  3.  </div>

=== Data ===

  1.  $data array(
  2.    'foo' => array(
  3.        'bar' => array('printMe')
  4.    )
  5.  );

=== `QueryTemplates` formula ===

  1.  $template['p']->
  2.      varPrint('data.foo.bar.0')
  3.  ;

=== Template ===

  1.  <div>
  2.      <p><?php  if (isset($data['foo']['bar']['0'])) print $data['foo']['bar']['0'];
  3.  else if (isset($data->{'foo'}->{'bar'}->{'0'})) print $data->{'foo'}->{'bar'}->{'0'};  ?></p>
  4.  </div>

=== Template tree before ===

  1.  div
  2.   - p
  3.   -  - Text:FOO

=== Template tree after ===

  1.  div
  2.   - p
  3.   -  - PHP




Tags:

access:  public


Parameters:

String   $varName   Variable avaible in scope of type Array or Object. $varName should NOT start with $.

[ Top ]

method varPrintAfter [line 247]

QueryTemplatesPhpQuery|QueryTemplatesParse varPrintAfter( String $varName)

Prints variable $varName after matched elements.

== Example ==

=== Markup ===

  1.  <div>
  2.      <p>FOO</p>
  3.  </div>

=== Data ===

  1.  $data array(
  2.    'foo' => array(
  3.        'bar' => array('printMe')
  4.    )
  5.  );

=== `QueryTemplates` formula ===

  1.  $template['p']->
  2.      varPrintAfter('data.foo.bar.0')
  3.  ;

=== Template ===

  1.  <div>
  2.      <p>FOO</p>
  3.  <?php  if (isset($data['foo']['bar']['0'])) print $data['foo']['bar']['0'];
  4.  else if (isset($data->{'foo'}->{'bar'}->{'0'})) print $data->{'foo'}->{'bar'}->{'0'};  ?>
  5.  </div>

=== Template tree before ===

  1.  div
  2.   - p
  3.   -  - Text:FOO

=== Template tree after ===

  1.  div
  2.   - p
  3.   -  - Text:FOO
  4.   - PHP




Tags:

access:  public


Parameters:

String   $varName   Variable avaible in scope of type Array or Object. $varName should NOT start with $.

[ Top ]

method varPrintAppend [line 367]

QueryTemplatesPhpQuery|QueryTemplatesParse varPrintAppend( String $varName)

Prints variable $varName on the end of matched elements.

== Example ==

=== Markup ===

  1.  <div>
  2.      <p>FOO</p>
  3.  </div>

=== Data ===

  1.  $data array(
  2.    'foo' => array(
  3.        'bar' => array('printMe')
  4.    )
  5.  );

=== `QueryTemplates` formula ===

  1.  $template['p']->
  2.      varPrintAppend('data.foo.bar.0')
  3.  ;

=== Template ===

  1.  <div>
  2.      <p>FOO<?php  if (isset($data['foo']['bar']['0'])) print $data['foo']['bar']['0'];
  3.  else if (isset($data->{'foo'}->{'bar'}->{'0'})) print $data->{'foo'}->{'bar'}->{'0'};  ?></p>
  4.  </div>

=== Template tree before ===

  1.  div
  2.   - p
  3.   -  - Text:FOO

=== Template tree after ===

  1.  div
  2.   - p
  3.   -  - Text:FOO
  4.   -  - PHP




Tags:

access:  public


Parameters:

String   $varName   Variable avaible in scope of type Array or Object. $varName should NOT start with $.

[ Top ]

method varPrintAttr [line 449]

QueryTemplatesPhpQuery|QueryTemplatesParse varPrintAttr( String $attr, String $varName)

Prints variable $varName as attribute $attr of matched elements.

== Example ==

=== Markup ===

  1.  <div>
  2.      <p>FOO</p>
  3.  </div>

=== Data ===

  1.  $data array(
  2.    'foo' => array(
  3.        'bar' => array('printMe')
  4.    )
  5.  );

=== `QueryTemplates` formula ===

  1.  $template['p']->
  2.      varPrintAttr('rel''data.foo.bar.0')
  3.  ;

=== Template ===

  1.  <div>
  2.      <p data.foo.bar.0="<?php  if (isset($data['foo']['bar']['0'])) print $data['foo']['bar']['0'];
  3.  else if (isset($data->{'foo'}->{'bar'}->{'0'})) print $data->{'foo'}->{'bar'}->{'0'};  ?>">FOO</p>
  4.  </div>

=== Template tree before ===

  1.  div
  2.   - p
  3.   -  - Text:FOO

=== Template tree after ===

  1.  div
  2.   - p
  3.   -  - Text:FOO




Tags:

access:  public


Parameters:

String   $attr   Target attribute name.
String   $varName   Variable avaible in scope of type Array or Object. $varName should NOT start with $.

[ Top ]

method varPrintBefore [line 186]

QueryTemplatesPhpQuery|QueryTemplatesParse varPrintBefore( String $varName)

Prints variable $varName before matched elements.

== Example ==

=== Markup ===

  1.  <div>
  2.      <p>FOO</p>
  3.  </div>

=== Data ===

  1.  $data array(
  2.    'foo' => array(
  3.        'bar' => array('printMe')
  4.    )
  5.  );

=== `QueryTemplates` formula ===

  1.  $template['p']->
  2.      varPrintBefore('data.foo.bar.0')
  3.  ;

=== Template ===

  1.  <div>
  2.      <?php  if (isset($data['foo']['bar']['0'])) print $data['foo']['bar']['0'];
  3.  else if (isset($data->{'foo'}->{'bar'}->{'0'})) print $data->{'foo'}->{'bar'}->{'0'};  ?><p>FOO</p>
  4.  </div>

=== Template tree before ===

  1.  div
  2.   - p
  3.   -  - Text:FOO

=== Template tree after ===

  1.  div
  2.   - PHP
  3.   - p
  4.   -  - Text:FOO




Tags:

access:  public


Parameters:

String   $varName   Variable avaible in scope of type Array or Object. $varName should NOT start with $.

[ Top ]

method varPrintPrepend [line 307]

QueryTemplatesPhpQuery|QueryTemplatesParse varPrintPrepend( String $varName)

Prints variable $varName on beggining of matched elements.

== Example ==

=== Markup ===

  1.  <div>
  2.      <p>FOO</p>
  3.  </div>

=== Data ===

  1.  $data array(
  2.    'foo' => array(
  3.        'bar' => array('printMe')
  4.    )
  5.  );

=== `QueryTemplates` formula ===

  1.  $template['p']->
  2.      varPrintPrepend('data.foo.bar.0')
  3.  ;

=== Template ===

  1.  <div>
  2.      <p><?php  if (isset($data['foo']['bar']['0'])) print $data['foo']['bar']['0'];
  3.  else if (isset($data->{'foo'}->{'bar'}->{'0'})) print $data->{'foo'}->{'bar'}->{'0'};  ?>FOO</p>
  4.  </div>

=== Template tree before ===

  1.  div
  2.   - p
  3.   -  - Text:FOO

=== Template tree after ===

  1.  div
  2.   - p
  3.   -  - PHP
  4.   -  - Text:FOO




Tags:

access:  public


Parameters:

String   $varName   Variable avaible in scope of type Array or Object. $varName should NOT start with $.

[ Top ]

method varPrintReplace [line 126]

QueryTemplatesPhpQuery|QueryTemplatesParse varPrintReplace( String $varName)

Prints variable $varName replacing matched elements.

== Example ==

=== Markup ===

  1.  <div>
  2.      <p>FOO</p>
  3.  </div>

=== Data ===

  1.  $data array(
  2.    'foo' => array(
  3.        'bar' => array('printMe')
  4.    )
  5.  );

=== `QueryTemplates` formula ===

  1.  $template['p']->
  2.      varPrintReplace('data.foo.bar.0')
  3.  ;

=== Template ===

  1.  <div>
  2.      <?php  if (isset($data['foo']['bar']['0'])) print $data['foo']['bar']['0'];
  3.  else if (isset($data->{'foo'}->{'bar'}->{'0'})) print $data->{'foo'}->{'bar'}->{'0'};  ?>
  4.  </div>

=== Template tree before ===

  1.  div
  2.   - p
  3.   -  - Text:FOO

=== Template tree after ===

  1.  div
  2.   - PHP




Tags:

access:  public


Parameters:

String   $varName   Variable avaible in scope of type Array or Object. $varName should NOT start with $.

[ Top ]

method varsToForm [line 2670]

QueryTemplatesParse|QueryTemplatesPhpQuery varsToForm( String $varName, Array|Object $varFields, [String $selectorPattern = "[name*='%k']"])

Injects executable code which toggles form fields values and selection states according to value of variable $varName.

This includes:

  • `input[type=radio][checked]`
  • `input[type=checkbox][checked]`
  • `select > option[selected]`
  • `input[value]`
  • `textarea`
Inputs are selected according to $selectorPattern, where %k represents variable's key.

== Example ==

=== Markup ===

  1.  <form>
  2.    <input name='input-example'>
  3.    <input name='array[array-example]'>
  4.    <textarea name='textarea-example'></textarea>
  5.    <select name='select-example'>
  6.      <option value='first' selected='selected'></option>
  7.    </select>
  8.    <input type='radio' name='radio-example' value='foo'>
  9.    <input type='checkbox' name='checkbox-example' value='foo'>
  10.  </form>

=== Data ===

  1.  $data array(
  2.    'input-example' => 'foo',
  3.    'array-example' => 'foo',
  4.    'textarea-example' => 'foo',
  5.    'select-example' => 'foo',
  6.    'radio-example' => 'foo',
  7.    'checkbox-example' => 'foo',
  8.  );

=== `QueryTemplates` formula ===

  1.  $template->
  2.      varsToForm('data'$data)
  3.  ;

=== Template ===

  1.  <form>
  2.    <input name="input-example" value="<?php  if (isset($data['input-example'])) print $data['input-example'];
  3.  else if (isset($data->{'input-example'})) print $data->{'input-example'};  ?>"><input name="array[array-example]" value="<?php  if (isset($data['array-example'])) print $data['array-example'];
  4.  else if (isset($data->{'array-example'})) print $data->{'array-example'};  ?>"><textarea name="textarea-example"><?php  if (isset($data['textarea-example'])) print $data['textarea-example'];
  5.  else if (isset($data->{'textarea-example'})) print $data->{'textarea-example'};  ?></textarea><select name="select-example"><?php  if ((isset($data['select-example']&& $data['select-example'== 'first')
  6.      || (isset($data->{'select-example'}&& $data->{'select-example'== 'first')) {  ?><option value="first" selected></option>
  7.  <?php  }    else {  ?><option value="first"></option>
  8.  <?php  }  ?></select><?php  if ((isset($data['radio-example']&& $data['radio-example'== 'foo')
  9.      || (isset($data->{'radio-example'}&& $data->{'radio-example'== 'foo')) {  ?><input type="radio" name="radio-example" value="foo" checked><?php  }    else {  ?><input type="radio" name="radio-example" value="foo"><?php  }    if ((isset($data['checkbox-example']&& $data['checkbox-example'== 'foo')
  10.      || (isset($data->{'checkbox-example'}&& $data->{'checkbox-example'== 'foo')) {  ?><input type="checkbox" name="checkbox-example" value="foo" checked><?php  }    else {  ?><input type="checkbox" name="checkbox-example" value="foo"><?php  }  ?>
  11.  </form>

=== Template tree before ===

  1.  form
  2.   - input[name="input-example"]
  3.   - input[name="array[array-example]"]
  4.   - textarea[name="textarea-example"]
  5.   - select[name="select-example"]
  6.   -  - option[value="first"][selected]
  7.   - input[name="radio-example"][value="foo"]
  8.   - input[name="checkbox-example"][value="foo"]

=== Template tree after ===

  1.  form
  2.   - input[name="input-example"][value=PHP]
  3.   - input[name="array[array-example]"][value=PHP]
  4.   - textarea[name="textarea-example"]
  5.   -  - PHP
  6.   - select[name="select-example"]
  7.   -  - PHP
  8.   -  - option[value="first"][selected]
  9.   -  - PHP
  10.   -  - PHP
  11.   -  - option[value="first"]
  12.   -  - PHP
  13.   - PHP
  14.   - input[name="radio-example"][value="foo"][checked]
  15.   - PHP
  16.   - PHP
  17.   - input[name="radio-example"][value="foo"]
  18.   - PHP
  19.   - PHP
  20.   - input[name="checkbox-example"][value="foo"][checked]
  21.   - PHP
  22.   - PHP
  23.   - input[name="checkbox-example"][value="foo"]
  24.   - PHP




Tags:

see:  QueryTemplatesPhpQuery::valuesToForm()
see:  QueryTemplatesPhpQuery::formFromVars()
TODO:  support select[multiple] (thou array)
access:  public


Parameters:

String   $varName   Variable avaible in scope of type Array or Object. $varName should NOT start with $.
Array|Object   $varFields  
String   $selectorPattern   Defines pattern matching form fields. Defaults to "[name*='%k']", which matches fields containing variable's key in their names. For example, to match only names starting with "foo[bar]" change $selectorPattern to "[name^='foo[bar]'][name*='%k']"

[ Top ]

method varsToLoop [line 2461]

QueryTemplatesPhpQuery|QueryTemplatesParse varsToLoop( String $varName, String $rowName, [String $indexName = null])

Wraps selected elements with executable code iterating $varName as $rowName.

Method doesn't change selected nodes stack.

== Example ==

=== Markup ===

  1.  <ul>
  2.      <li class='row'>
  3.          <span class='name'></span>
  4.          <ul class='tags'>
  5.              <li class='tag'>
  6.                  <span class='name'></span>
  7.              </li>
  8.          </ul>
  9.      </li>
  10.  </ul>

=== Data ===

  1.  $data array(
  2.      array(
  3.          'User' => array('name' => 'foo'),
  4.          'Tags' => array(
  5.              array('name' => 'php'),
  6.              array('name' => 'js'),
  7.          ),
  8.      ),
  9.      array(
  10.          'User' => array('name' => 'bar'),
  11.          'Tags' => array(
  12.              array('name' => 'perl'),
  13.          ),
  14.      ),
  15.      array(
  16.          'User' => array('name' => 'fooBar'),
  17.          'Tags' => array(
  18.              array('name' => 'php'),
  19.              array('name' => 'js'),
  20.              array('name' => 'perl'),
  21.          ),
  22.      ),
  23.  );
  24.  $userFields array('name');
  25.  $tagFields array('name');

=== `QueryTemplates` formula ===

  1.  $template->
  2.      find('> ul > li')->
  3.          varsToLoop('data''row')->
  4.          varsToSelector('row'$userFields'span.%k')->
  5.          find('> ul > li')->
  6.              varsToLoop('row.Tags''tag')->
  7.              varsToSelector('tag'$tagFields)
  8.  ;

=== Template ===

  1.  <ul>
  2.  <?php  if (isset($data&& (is_array($data|| is_object($data))) foreach($data as $row):  ?><li class="row">
  3.          <span class="name"><?php  if (isset($row['name'])) print $row['name'];
  4.  else if (isset($row->{'name'})) print $row->{'name'};  ?></span>
  5.          <ul class="tags">
  6.  <?php  if (isset($row['Tags'])) $__8daca $row['Tags']else if (isset($row->{'Tags'})) $__8daca $row->{'Tags'}if (isset($__8daca&& (is_array($__8daca|| is_object($__8daca))) foreach($__8daca as $tag):  ?><li class="tag">
  7.                  <span class="name"><?php  if (isset($tag['name'])) print $tag['name'];
  8.  else if (isset($tag->{'name'})) print $tag->{'name'};  ?></span>
  9.              </li>
  10.  <?php  endforeach}  ?>
  11.          </ul>
  12.  </li>
  13.  <?php  endforeach}  ?>
  14.  </ul>

=== Template tree before ===

  1.  ul
  2.   - li.row
  3.   -  - span.name
  4.   -  - ul.tags
  5.   -  -  - li.tag
  6.   -  -  -  - span.name

=== Template tree after ===

  1.  ul
  2.   - PHP
  3.   - li.row
  4.   -  - span.name
  5.   -  -  - PHP
  6.   -  - ul.tags
  7.   -  -  - PHP
  8.   -  -  - li.tag
  9.   -  -  -  - span.name
  10.   -  -  -  -  - PHP
  11.   -  -  - PHP
  12.   - PHP




Tags:

see:  QueryTemplatesPhpQuery::valuesToLoop()
access:  public


Parameters:

String   $varName   Variable which will be looped. Must contain $ at the beggining.
String   $rowName   Name of variable being result of iteration.
String   $indexName   Optional. Use it when you want to have $varName's key available in the scope.

[ Top ]

method varsToLoopFirst [line 2513]

QueryTemplatesPhpQuery|QueryTemplatesParse varsToLoopFirst( String $varName, String $rowName, [String $indexName = null])

Wraps selected elements with executable code iterating $varName as $rowName.

Acts as varsToLoop(), but loops only first node from stack. Rest is removed from the DOM.

Method DOES change selected nodes stack. Returned is first node.




Tags:

see:  QueryTemplatesPhpQuery::varsToLoop()
access:  public


Parameters:

String   $varName   Variable which will be looped. Must contain $ at the beggining.
String   $rowName   Name of variable being result of iteration.
String   $indexName   Optional. Use it when you want to have $varName's key available in the scope.

[ Top ]

method varsToLoopSeparate [line 2483]

QueryTemplatesPhpQuery|QueryTemplatesParse varsToLoopSeparate( String $varName, String $rowName, [String $indexName = null])

Wraps selected elements with executable code iterating $varName as $rowName.

Acts as varsToLoop(), but affects each selected element separately.

Method doesn't change selected nodes stack.




Tags:

see:  QueryTemplatesPhpQuery::varsToLoop()
access:  public


Parameters:

String   $varName   Variable which will be looped. Must contain $ at the beggining.
String   $rowName   Name of variable being result of iteration.
String   $indexName   Optional. Use it when you want to have $varName's key available in the scope.

[ Top ]

method varsToSelector [line 533]

QueryTemplatesPhpQuery|QueryTemplatesParse varsToSelector( String $varName, Array|Object $varFields, [String $selectorPattern = '.%k'], [Array $skipFields = null], [Callback|string $fieldCallback = null])

Injects executable code printing variable's fields 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.  $foo new stdClass();
  2.  $foo->field1 'foo';
  3.  $foo->field2 'bar';

=== `QueryTemplates` formula ===

  1.  $template->
  2.      varsToSelector('foo'$foo)
  3.  ;

=== Template ===

  1.  <p class="field1"><?php  if (isset($foo['field1'])) print $foo['field1'];
  2.  else if (isset($foo->{'field1'})) print $foo->{'field1'};  ?></p>
  3.  <p class="field2"><?php  if (isset($foo['field2'])) print $foo['field2'];
  4.  else if (isset($foo->{'field2'})) print $foo->{'field2'};  ?></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()
see:  QueryTemplatesPhpQuery::varsToForm()
access:  public


Parameters:

String   $varName   Variable avaible in scope of type Array or Object. $varName should NOT start with $.
Array|Object   $varFields   Variable value with all fields (keys) OR array of variable fields (keys).
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 varsToSelectorAfter [line 877]

QueryTemplatesPhpQuery|QueryTemplatesParse varsToSelectorAfter( String $varName, Array|Object $varFields, [String $selectorPattern = '.%k'], [Array $skipFields = null], [Callback|string $fieldCallback = null])

Injects executable code printing variable's fields 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.  $foo new stdClass();
  2.  $foo->field1 'foo';
  3.  $foo->field2 'bar';

=== `QueryTemplates` formula ===

  1.  $template->
  2.      varsToSelectorAfter('foo'$foo)
  3.  ;

=== Template ===

  1.  <p class="field1">lorem ipsum</p>
  2.  <?php  if (isset($foo['field1'])) print $foo['field1'];
  3.  else if (isset($foo->{'field1'})) print $foo->{'field1'};  ?>
  4.  <p class="field2">lorem ipsum</p>
  5.  <?php  if (isset($foo['field2'])) print $foo['field2'];
  6.  else if (isset($foo->{'field2'})) print $foo->{'field2'};  ?>

=== 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()
see:  QueryTemplatesPhpQuery::varsToForm()
access:  public


Parameters:

String   $varName   Variable avaible in scope of type Array or Object. $varName should NOT start with $.
Array|Object   $varFields   Variable value with all fields (keys) OR array of variable fields (keys).
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 varsToSelectorAppend [line 702]

QueryTemplatesPhpQuery|QueryTemplatesParse varsToSelectorAppend( String $varName, Array|Object $varFields, [String $selectorPattern = '.%k'], [Array $skipFields = null], [Callback|string $fieldCallback = null])

Injects executable code printing variable's fields 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.  $foo new stdClass();
  2.  $foo->field1 'foo';
  3.  $foo->field2 'bar';

=== `QueryTemplates` formula ===

  1.  $template->
  2.      varsToSelectorAppend('foo'$foo)
  3.  ;

=== Template ===

  1.  <p class="field1">lorem ipsum<?php  if (isset($foo['field1'])) print $foo['field1'];
  2.  else if (isset($foo->{'field1'})) print $foo->{'field1'};  ?></p>
  3.  <p class="field2">lorem ipsum<?php  if (isset($foo['field2'])) print $foo['field2'];
  4.  else if (isset($foo->{'field2'})) print $foo->{'field2'};  ?></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()
see:  QueryTemplatesPhpQuery::varsToForm()
access:  public


Parameters:

String   $varName   Variable avaible in scope of type Array or Object. $varName should NOT start with $.
Array|Object   $varFields   Variable value with all fields (keys) OR array of variable fields (keys).
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 varsToSelectorAttr [line 1051]

QueryTemplatesPhpQuery|QueryTemplatesParse varsToSelectorAttr( String $attr, String $varName, Array|Object $varFields, [String $selectorPattern = '.%k'], [Array $skipFields = null], [Callback|string $fieldCallback = null])

Injects executable code printing variable's fields 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 ===

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

=== Data ===

  1.  $foo new stdClass();
  2.  $foo->field1 'foo';
  3.  $foo->field2 'bar';

=== `QueryTemplates` formula ===

  1.  $template->
  2.      varsToSelectorAttr('rel''foo'$foo)
  3.  ;

=== Template ===

  1.  <p class="field1" rel="<?php  if (isset($foo['field1'])) print $foo['field1'];
  2.  else if (isset($foo->{'field1'})) print $foo->{'field1'};  ?>">lorem ipsum</p>
  3.  <p class="field2" rel="<?php  if (isset($foo['field2'])) print $foo['field2'];
  4.  else if (isset($foo->{'field2'})) print $foo->{'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.  p.field1
  2.   - Text:lorem ipsum
  3.  p.field2
  4.   - Text:lorem ipsum




Tags:

see:  QueryTemplatesPhpQuery::varsToStack()
see:  QueryTemplatesPhpQuery::varsToForm()
access:  public


Parameters:

String   $attr   Target attribute name.
String   $varName   Variable avaible in scope of type Array or Object. $varName should NOT start with $.
Array|Object   $varFields   Variable value with all fields (keys) OR array of variable fields (keys).
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 varsToSelectorBefore [line 963]

QueryTemplatesPhpQuery|QueryTemplatesParse varsToSelectorBefore( String $varName, Array|Object $varFields, [String $selectorPattern = '.%k'], [Array $skipFields = null], [Callback|string $fieldCallback = null])

Injects executable code printing variable's fields 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.  $foo new stdClass();
  2.  $foo->field1 'foo';
  3.  $foo->field2 'bar';

=== `QueryTemplates` formula ===

  1.  $template->
  2.      varsToSelectorBefore('foo'$foo)
  3.  ;

=== Template ===

  1.  <?php  if (isset($foo['field1'])) print $foo['field1'];
  2.  else if (isset($foo->{'field1'})) print $foo->{'field1'};  ?><p class="field1">lorem ipsum</p>
  3.  <?php  if (isset($foo['field2'])) print $foo['field2'];
  4.  else if (isset($foo->{'field2'})) print $foo->{'field2'};  ?><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()
see:  QueryTemplatesPhpQuery::varsToForm()
access:  public


Parameters:

String   $varName   Variable avaible in scope of type Array or Object. $varName should NOT start with $.
Array|Object   $varFields   Variable value with all fields (keys) OR array of variable fields (keys).
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 varsToSelectorPrepend [line 789]

QueryTemplatesPhpQuery|QueryTemplatesParse varsToSelectorPrepend( String $varName, Array|Object $varFields, [String $selectorPattern = '.%k'], [Array $skipFields = null], [Callback|string $fieldCallback = null])

Injects executable code printing variable's fields 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.  $foo new stdClass();
  2.  $foo->field1 'foo';
  3.  $foo->field2 'bar';

=== `QueryTemplates` formula ===

  1.  $template->
  2.      varsToSelectorPrepend('foo'$foo)
  3.  ;

=== Template ===

  1.  <p class="field1"><?php  if (isset($foo['field1'])) print $foo['field1'];
  2.  else if (isset($foo->{'field1'})) print $foo->{'field1'};  ?>lorem ipsum</p>
  3.  <p class="field2"><?php  if (isset($foo['field2'])) print $foo['field2'];
  4.  else if (isset($foo->{'field2'})) print $foo->{'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.  p.field1
  2.   - PHP
  3.   - Text:lorem ipsum
  4.  p.field2
  5.   - PHP
  6.   - Text:lorem ipsum




Tags:

see:  QueryTemplatesPhpQuery::varsToStack()
see:  QueryTemplatesPhpQuery::varsToForm()
access:  public


Parameters:

String   $varName   Variable avaible in scope of type Array or Object. $varName should NOT start with $.
Array|Object   $varFields   Variable value with all fields (keys) OR array of variable fields (keys).
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 varsToSelectorReplace [line 615]

QueryTemplatesPhpQuery|QueryTemplatesParse varsToSelectorReplace( String $varName, Array|Object $varFields, [String $selectorPattern = '.%k'], [Array $skipFields = null], [Callback|string $fieldCallback = null])

Injects executable code printing variable's fields 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.  $foo new stdClass();
  2.  $foo->field1 'foo';
  3.  $foo->field2 'bar';

=== `QueryTemplates` formula ===

  1.  $template->
  2.      varsToSelectorReplace('foo'$foo)
  3.  ;

=== Template ===

  1.  <?php  if (isset($foo['field1'])) print $foo['field1'];
  2.  else if (isset($foo->{'field1'})) print $foo->{'field1'};  ?>
  3.  <?php  if (isset($foo['field2'])) print $foo['field2'];
  4.  else if (isset($foo->{'field2'})) print $foo->{'field2'};  ?>

=== 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()
see:  QueryTemplatesPhpQuery::varsToForm()
access:  public


Parameters:

String   $varName   Variable avaible in scope of type Array or Object. $varName should NOT start with $.
Array|Object   $varFields   Variable value with all fields (keys) OR array of variable fields (keys).
String   $selectorPattern   Defines pattern matching target nodes. %k represents key. Defaults to ".%k", which matches nodes with class name equivalent to data source key. 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 varsToStack [line 1179]

QueryTemplatesParse|QueryTemplatesPhpQuery varsToStack( String $varName, Array|Object $varFields, [Array $skipFields = null], [Callback|string $fieldCallback = null])

Injects executable code printing variable's fields inside actually matched nodes. Second param needs to be wrapped with array_keys for non-assosiative arrays.

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.  $foo new stdClass();
  2.  $foo->first 'foo';
  3.  $foo->second 'bar';

=== `QueryTemplates` formula ===

  1.  $template['node1']->
  2.      varsToStack('foo'$foo)
  3.  ;

=== Template ===

  1.  <node1><?php  if (isset($foo['first'])) print $foo['first'];
  2.  else if (isset($foo->{'first'})) print $foo->{'first'};  ?></node1><node2></node2><node1><?php  if (isset($foo['second'])) print $foo['second'];
  3.  else if (isset($foo->{'second'})) print $foo->{'second'};  ?></node1>

=== Template tree before ===

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

=== Template tree after ===

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




Tags:

see:  QueryTemplatesPhpQuery::varsToSelector()
see:  QueryTemplatesPhpQuery::varsToForm()
access:  public


Parameters:

String   $varName   Variable avaible in scope of type Array or Object. $varName should NOT start with $.
Array|Object   $varFields   Variable value with all fields (keys) OR array of variable fields (keys). Param needs to be passed thou array_keys for non-assosiative arrays.
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 varsToStackAfter [line 1523]

QueryTemplatesParse|QueryTemplatesPhpQuery varsToStackAfter( String $varName, Array|Object $varFields, [Array $skipFields = null], [Callback|string $fieldCallback = null])

Injects executable code printing variable's fields after actually matched nodes. Second param needs to be wrapped with array_keys for non-assosiative arrays.

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.  $foo new stdClass();
  2.  $foo->first 'foo';
  3.  $foo->second 'bar';

=== `QueryTemplates` formula ===

  1.  $template['node1']->
  2.      varsToStackAfter('foo'$foo)
  3.  ;

=== Template ===

  1.  <node1><node2></node2></node1><?php  if (isset($foo['first'])) print $foo['first'];
  2.  else if (isset($foo->{'first'})) print $foo->{'first'};  ?><node2></node2><node1><node2></node2></node1><?php  if (isset($foo['second'])) print $foo['second'];
  3.  else if (isset($foo->{'second'})) print $foo->{'second'};  ?>

=== Template tree before ===

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

=== Template tree after ===

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




Tags:

see:  QueryTemplatesPhpQuery::varsToSelector()
see:  QueryTemplatesPhpQuery::varsToForm()
access:  public


Parameters:

String   $varName   Variable avaible in scope of type Array or Object. $varName should NOT start with $.
Array|Object   $varFields   Variable value with all fields (keys) OR array of variable fields (keys). Param needs to be passed thou array_keys for non-assosiative arrays.
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 varsToStackAppend [line 1349]

QueryTemplatesParse|QueryTemplatesPhpQuery varsToStackAppend( String $varName, Array|Object $varFields, [Array $skipFields = null], [Callback|string $fieldCallback = null])

Injects executable code printing variable's fields at the end of actually matched nodes. Second param needs to be wrapped with array_keys for non-assosiative arrays.

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.  $foo new stdClass();
  2.  $foo->first 'foo';
  3.  $foo->second 'bar';

=== `QueryTemplates` formula ===

  1.  $template['node1']->
  2.      varsToStackAppend('foo'$foo)
  3.  ;

=== Template ===

  1.  <node1><node2></node2><?php  if (isset($foo['first'])) print $foo['first'];
  2.  else if (isset($foo->{'first'})) print $foo->{'first'};  ?></node1><node2></node2><node1><node2></node2><?php  if (isset($foo['second'])) print $foo['second'];
  3.  else if (isset($foo->{'second'})) print $foo->{'second'};  ?></node1>

=== Template tree before ===

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

=== Template tree after ===

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




Tags:

see:  QueryTemplatesPhpQuery::varsToSelector()
see:  QueryTemplatesPhpQuery::varsToForm()
access:  public


Parameters:

String   $varName   Variable avaible in scope of type Array or Object. $varName should NOT start with $.
Array|Object   $varFields   Variable value with all fields (keys) OR array of variable fields (keys). Param needs to be passed thou array_keys for non-assosiative arrays.
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 varsToStackAttr [line 1698]

QueryTemplatesParse|QueryTemplatesPhpQuery varsToStackAttr( String $attr, String $varName, Array|Object $varFields, [Array $skipFields = null], [Callback|string $fieldCallback = null])

Injects executable code printing variable's fields as attribute of actually matched nodes. Second param needs to be wrapped with array_keys for non-assosiative arrays.

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.  $foo new stdClass();
  2.  $foo->first 'foo';
  3.  $foo->second 'bar';

=== `QueryTemplates` formula ===

  1.  $template['node1']->
  2.      varsToStackAttr('rel''foo'$foo)
  3.  ;

=== Template ===

  1.  <node1 rel="<?php  if (isset($foo['first'])) print $foo['first'];
  2.  else if (isset($foo->{'first'})) print $foo->{'first'};  ?>"><node2></node2></node1><node2></node2><node1 rel="<?php  if (isset($foo['second'])) print $foo['second'];
  3.  else if (isset($foo->{'second'})) print $foo->{'second'};  ?>"><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::varsToSelector()
see:  QueryTemplatesPhpQuery::varsToForm()
access:  public


Parameters:

String   $attr   Target attribute name.
String   $varName   Variable avaible in scope of type Array or Object. $varName should NOT start with $.
Array|Object   $varFields   Variable value with all fields (keys) OR array of variable fields (keys). Param needs to be passed thou array_keys for non-assosiative arrays.
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 varsToStackBefore [line 1610]

QueryTemplatesParse|QueryTemplatesPhpQuery varsToStackBefore( String $varName, Array|Object $varFields, [Array $skipFields = null], [Callback|string $fieldCallback = null])

Injects executable code printing variable's fields before actually matched nodes. Second param needs to be wrapped with array_keys for non-assosiative arrays.

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.  $foo new stdClass();
  2.  $foo->first 'foo';
  3.  $foo->second 'bar';

=== `QueryTemplates` formula ===

  1.  $template['node1']->
  2.      varsToStackBefore('foo'$foo)
  3.  ;

=== Template ===

  1.  <?php  if (isset($foo['first'])) print $foo['first'];
  2.  else if (isset($foo->{'first'})) print $foo->{'first'};  ?><node1><node2></node2></node1><node2></node2><?php  if (isset($foo['second'])) print $foo['second'];
  3.  else if (isset($foo->{'second'})) print $foo->{'second'};  ?><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.  PHP
  6.  node1
  7.   - node2




Tags:

see:  QueryTemplatesPhpQuery::varsToSelector()
see:  QueryTemplatesPhpQuery::varsToForm()
access:  public


Parameters:

String   $varName   Variable avaible in scope of type Array or Object. $varName should NOT start with $.
Array|Object   $varFields   Variable value with all fields (keys) OR array of variable fields (keys). Param needs to be passed thou array_keys for non-assosiative arrays.
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 varsToStackPrepend [line 1436]

QueryTemplatesParse|QueryTemplatesPhpQuery varsToStackPrepend( String $varName, Array|Object $varFields, [Array $skipFields = null], [Callback|string $fieldCallback = null])

Injects executable code printing variable's fields at the beggining of actually matched nodes. Second param needs to be wrapped with array_keys for non-assosiative arrays.

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.  $foo new stdClass();
  2.  $foo->first 'foo';
  3.  $foo->second 'bar';

=== `QueryTemplates` formula ===

  1.  $template['node1']->
  2.      varsToStackPrepend('foo'$foo)
  3.  ;

=== Template ===

  1.  <node1><?php  if (isset($foo['first'])) print $foo['first'];
  2.  else if (isset($foo->{'first'})) print $foo->{'first'};  ?><node2></node2></node1><node2></node2><node1><?php  if (isset($foo['second'])) print $foo['second'];
  3.  else if (isset($foo->{'second'})) print $foo->{'second'};  ?><node2></node2></node1>

=== Template tree before ===

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

=== Template tree after ===

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




Tags:

see:  QueryTemplatesPhpQuery::varsToSelector()
see:  QueryTemplatesPhpQuery::varsToForm()
access:  public


Parameters:

String   $varName   Variable avaible in scope of type Array or Object. $varName should NOT start with $.
Array|Object   $varFields   Variable value with all fields (keys) OR array of variable fields (keys). Param needs to be passed thou array_keys for non-assosiative arrays.
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 varsToStackReplace [line 1262]

QueryTemplatesParse|QueryTemplatesPhpQuery varsToStackReplace( String $varName, Array|Object $varFields, [Array $skipFields = null], [Callback|string $fieldCallback = null])

Injects executable code printing variable's fields replacing actually matched nodes. Second param needs to be wrapped with array_keys for non-assosiative arrays.

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.  $foo new stdClass();
  2.  $foo->first 'foo';
  3.  $foo->second 'bar';

=== `QueryTemplates` formula ===

  1.  $template['node1']->
  2.      varsToStackReplace('foo'$foo)
  3.  ;

=== Template ===

  1.  <?php  if (isset($foo['first'])) print $foo['first'];
  2.  else if (isset($foo->{'first'})) print $foo->{'first'};  ?><node2></node2><?php  if (isset($foo['second'])) print $foo['second'];
  3.  else if (isset($foo->{'second'})) print $foo->{'second'};  ?>

=== Template tree before ===

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

=== Template tree after ===

  1.  PHP
  2.  node2
  3.  PHP




Tags:

see:  QueryTemplatesPhpQuery::varsToSelector()
see:  QueryTemplatesPhpQuery::varsToForm()
access:  public


Parameters:

String   $varName   Variable avaible in scope of type Array or Object. $varName should NOT start with $.
Array|Object   $varFields   Variable value with all fields (keys) OR array of variable fields (keys). Param needs to be passed thou array_keys for non-assosiative arrays.
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 _valuesToSelector [line 2315]

void _valuesToSelector( $target, $data, $selectorPattern, $skipFields, $fieldCallback)



Tags:

access:  protected


Parameters:

   $target  
   $data  
   $selectorPattern  
   $skipFields  
   $fieldCallback  

[ Top ]

method _varPrint [line 370]

void _varPrint( $target, $varName)



Tags:

access:  public


Parameters:

   $target  
   $varName  

[ Top ]

method _varsParseFields [line 1731]

void _varsParseFields( $varFields)



Tags:

access:  protected


Parameters:

   $varFields  

[ Top ]

method _varsToLoop [line 2488]

void _varsToLoop( $pq, $varName, $asVarName, $keyName)



Tags:

access:  protected


Parameters:

   $pq  
   $varName  
   $asVarName  
   $keyName  

[ Top ]

method _varsToSelector [line 1067]

unknown_type _varsToSelector( $target $target, $varName $varName, $varFields $varFields, $selectorPattern $selectorPattern, $skipFields $skipFields, $fieldCallback $fieldCallback)

Internal method.



Tags:

TODO:  support $varName to be a function (last char == ')'),
access:  protected


Parameters:

$target   $target  
$varName   $varName  
$varFields   $varFields  
$selectorPattern   $selectorPattern  
$skipFields   $skipFields  
$fieldCallback   $fieldCallback  

[ Top ]

method _varsToStack [line 1701]

void _varsToStack( $target, $varName, $varValue, $skipFields, $fieldCallback)



Tags:

access:  protected


Parameters:

   $target  
   $varName  
   $varValue  
   $skipFields  
   $fieldCallback  

[ Top ]


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