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

Class: QueryTemplatesSyntaxConditions

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

Class Overview

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

Class extending phpQueryObject with templating methods.


Author(s):

Methods


Child classes:

QueryTemplatesSyntaxVars
Class extending phpQueryObject with templating methods.

Inherited Variables

Inherited Methods

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 elseIfCode [line 719]

void elseIfCode( $code, [ $separate = false])



Tags:

access:  public


Parameters:

   $code  
   $separate  

[ Top ]

method elseIfNotVar [line 879]

QueryTemplatesParse|QueryTemplatesPhpQuery elseIfNotVar( string $var, [bool $separate = false])

Wraps selected tag with PHP "else if" statement checking if $var evaluates to FALSE. $var must be available inside template's scope.

$var is passed in JavaScript object notation (dot separated).

Optional $separate parameter determines if selected elements should be wrapped together or one-by-one. This is usefull when stack contains non-sibling nodes.

Method doesn't change selected nodes stack.

Notice-safe.

== Example ==

=== Markup ===

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

=== Data ===

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

=== `QueryTemplates` formula ===

  1.  $template['div:eq(1)']->elseIfNotVar('data.foo.bar.0');

=== Template ===

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

=== Template tree before ===

  1.  div
  2.   - Text:1
  3.  div
  4.   - Text:2
  5.  div
  6.   - Text:3

=== Template tree after ===

  1.  div
  2.   - Text:1
  3.  PHP
  4.  div
  5.   - Text:2
  6.  PHP
  7.  div
  8.   - Text:3




Tags:

access:  public


Parameters:

string   $var   Dot-separated object path, eg Object.property.inneProperty
bool   $separate   Determines if selected elements should be wrapped together or one-by-one

[ Top ]

method elseIfPHP [line 706]

QueryTemplatesParse|QueryTemplatesPhpQuery elseIfPHP( string $code, [bool $separate = false])

Wraps selected tag with PHP "else if" statement containing $code as condition.

Optional $separate parameter determines if selected elements should be wrapped together or one-by-one. This is usefull when stack contains non-sibling nodes.

Method doesn't change selected nodes stack.

Example

  1.  $template['node1']->elseIfPHP('$foo == 1');

Source

  1.  <node1/>

Result

  1.  <?php
  2.  else if ($foo == 1{
  3.  ?><node1/><?php
  4.  }
  5.  ?>




Tags:

TODO:  hardcode php code
access:  public


Parameters:

string   $code   Valid PHP condition code
bool   $separate   Determines if selected elements should be wrapped together or one-by-one

[ Top ]

method elseIfVar [line 797]

QueryTemplatesParse|QueryTemplatesPhpQuery elseIfVar( string $var, [bool $separate = false])

Wraps selected tag with PHP "else if" statement checking if $var evaluates to true. $var must be available inside template's scope.

$var is passed in JavaScript object notation (dot separated).

Optional $separate parameter determines if selected elements should be wrapped together or one-by-one. This is usefull when stack contains non-sibling nodes.

Method doesn't change selected nodes stack.

Notice-safe.

== Example ==

=== Markup ===

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

=== Data ===

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

=== `QueryTemplates` formula ===

  1.  $template['div:eq(1)']->elseIfVar('data.foo.bar.0');

=== Template ===

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

=== Template tree before ===

  1.  div
  2.   - Text:1
  3.  div
  4.   - Text:2
  5.  div
  6.   - Text:3

=== Template tree after ===

  1.  div
  2.   - Text:1
  3.  PHP
  4.  div
  5.   - Text:2
  6.  PHP
  7.  div
  8.   - Text:3




Tags:

access:  public


Parameters:

string   $var   Dot-separated object path, eg Object.property.inneProperty
bool   $separate   Determines if selected elements should be wrapped together or one-by-one

[ Top ]

method elsePHP [line 900]

QueryTemplatesParse|QueryTemplatesPhpQuery elsePHP( [bool $separate = false])

Wraps selected tag with PHP "else" statement.

Optional $separate parameter determines if selected elements should be wrapped together or one-by-one. This is usefull when stack contains non-sibling nodes.

Method doesn't change selected nodes stack.




Tags:

access:  public


Parameters:

bool   $separate   Determines if selected elements should be wrapped together or one-by-one

[ Top ]

method elseStatement [line 962]

QueryTemplatesParse|QueryTemplatesPhpQuery elseStatement( [$separate $separate = false], [$lang $lang = null])

TODO description

== Example ==

=== Markup ===

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

=== Data ===

    === `QueryTemplates` formula ===

    1.  $template['div:eq(1)']->
    2.      elseStatement()
    3.  ;

    === Template ===

    1.  <div>1</div>
    2.  <?php  else {  ?><div>2</div>
    3.  <?php  }  ?>
    4.  <div>3</div>

    === Template tree before ===

    1.  div
    2.   - Text:1
    3.  div
    4.   - Text:2
    5.  div
    6.   - Text:3

    === Template tree after ===

    1.  div
    2.   - Text:1
    3.  PHP
    4.  div
    5.   - Text:2
    6.  PHP
    7.  div
    8.   - Text:3




    Tags:

    access:  public


    Parameters:

    $separate   $separate  
    $lang   $lang  

    [ Top ]

    method endOnly [line 1020]

    QueryTemplatesParse|QueryTemplatesPhpQuery endOnly( )

    TODO docs



    Tags:

    access:  public


    [ Top ]

    method ifCode [line 582]

    unknown_type ifCode( $code $code, [$separate $separate = false])

    TODO doc



    Tags:

    access:  public


    Parameters:

    $code   $code  
    $separate   $separate  

    [ Top ]

    method ifNotVar [line 663]

    QueryTemplatesParse|QueryTemplatesPhpQuery ifNotVar( string $var, [bool $separate = false])

    Wraps selected tag with PHP "if" statement checking if $var evaluates to FALSE. $var must be available inside template's scope.

    $var is passed in JavaScript object notation (dot separated).

    Optional $separate parameter determines if selected elements should be wrapped together or one-by-one. This is usefull when stack contains non-sibling nodes.

    Method doesn't change selected nodes stack.

    Notice-safe.

    == Example ==

    === Markup ===

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

    === Data ===

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

    === `QueryTemplates` formula ===

    1.  $template['div:eq(1)']->
    2.      ifNotVar('data.foo.bar.0')
    3.  ;

    === Template ===

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

    === Template tree before ===

    1.  div
    2.   - Text:1
    3.  div
    4.   - Text:2
    5.  div
    6.   - Text:3

    === Template tree after ===

    1.  div
    2.   - Text:1
    3.  PHP
    4.  div
    5.   - Text:2
    6.  PHP
    7.  div
    8.   - Text:3




    Tags:

    see:  QueryTemplatesPhpQuery::elseStatement()
    access:  public


    Parameters:

    string   $var   Dot-separated object path, eg Object.property.inneProperty
    bool   $separate   Determines if selected elements should be wrapped together or one-by-one

    [ Top ]

    method ifPHP [line 476]

    QueryTemplatesParse|QueryTemplatesPhpQuery ifPHP( string $code, [bool $separate = false])

    Wraps selected tag with PHP "if" statement containing $code as condition.

    Optional $separate parameter determines if selected elements should be wrapped together or one-by-one. This is usefull when stack contains non-sibling nodes.

    Method doesn't change selected nodes stack.

    Example

    1.  $template['node1']->tagToElseIf('$foo == 1');

    Source

    1.  <node1/>

    Result

    1.  <?php
    2.  else if ($foo == 1{
    3.  ?><node1/><?php
    4.  }
    5.  ?>




    Tags:

    TODO:  hardcode php code
    access:  public


    Parameters:

    string   $code   Valid PHP condition code
    bool   $separate   Determines if selected elements should be wrapped together or one-by-one

    [ Top ]

    method ifVar [line 569]

    QueryTemplatesParse|QueryTemplatesPhpQuery ifVar( string $var, [bool $separate = false])

    Wraps selected tag with PHP "if" statement checking if $var evaluates to TRUE. $var must be available inside template's scope.

    $var is passed in JavaScript object notation (dot separated).

    Optional $separate parameter determines if selected elements should be wrapped together or one-by-one. This is usefull when stack contains non-sibling nodes.

    Method doesn't change selected nodes stack.

    Notice-safe.

    == Example ==

    === Markup ===

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

    === Data ===

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

    === `QueryTemplates` formula ===

    1.  $template['div:eq(1)']->
    2.      ifVar('data.foo.bar.0')
    3.  ;

    === Template ===

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

    === Template tree before ===

    1.  div
    2.   - Text:1
    3.  div
    4.   - Text:2
    5.  div
    6.   - Text:3

    === Template tree after ===

    1.  div
    2.   - Text:1
    3.  PHP
    4.  div
    5.   - Text:2
    6.  PHP
    7.  div
    8.   - Text:3




    Tags:

    see:  QueryTemplatesPhpQuery::elseStatement()
    access:  public


    Parameters:

    string   $var   Dot-separated object path, eg Object.property.inneProperty
    bool   $separate   Determines if selected elements should be wrapped together or one-by-one

    [ Top ]

    method onlyIf [line 1000]

    QueryTemplatesParse|QueryTemplatesPhpQuery onlyIf( $condition)

    TODO docs



    Tags:

    access:  public


    Parameters:

       $condition  

    [ Top ]

    method onlyIfNot [line 1012]

    QueryTemplatesParse|QueryTemplatesPhpQuery onlyIfNot( $condition)

    TODO docs



    Tags:

    access:  public


    Parameters:

       $condition  

    [ Top ]

    method onlyJS [line 992]

    QueryTemplatesParse|QueryTemplatesPhpQuery onlyJS( )

    TODO Move to jsCode plugin.



    Tags:

    access:  public


    [ Top ]

    method onlyPHP [line 984]

    QueryTemplatesParse|QueryTemplatesPhpQuery onlyPHP( )

    Honors code between onlyPHP and endOnly, only for PHP templates.

    TODO: Is theres something wrong with this name ?




    Tags:

    access:  public


    [ Top ]

    method tagToElseIfNotVar [line 413]

    QueryTemplatesParse|QueryTemplatesPhpQuery tagToElseIfNotVar( string $var)

    Replaces selected tag with PHP "else if" statement checking if $var evaluates to FALSE. $var must be available inside template's scope.

    $var is passed in JavaScript object notation (dot separated).

    Method doesn't change selected nodes stack. detached from it's parent.

    Notice-safe.

    == Example ==

    === Markup ===

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

    === Data ===

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

    === `QueryTemplates` formula ===

    1.  $template['div:eq(1)']->
    2.      tagToElseIfNotVar('data.foo.bar.0')
    3.  ;

    === Template ===

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

    === Template tree before ===

    1.  div
    2.   - Text:1
    3.  div
    4.   - Text:2
    5.  div
    6.   - Text:3

    === Template tree after ===

    1.  div
    2.   - Text:1
    3.  PHP
    4.  Text:2
    5.  PHP
    6.  div
    7.   - Text:3




    Tags:

    see:  QueryTemplatesPhpQuery::ifVar()
    access:  public


    Parameters:

    string   $var   Dot-separated object path, eg Object.property.inneProperty

    [ Top ]

    method tagToElseIfPHP [line 247]

    QueryTemplatesParse|QueryTemplatesPhpQuery tagToElseIfPHP( string $code)

    Replaces selected tag with PHP "else if" statement containing $code as condition.

    Method doesn't change selected nodes stack. detached from it's parent.

    Example

    1.  $template['.else-if']->tagToElseIfPHP('$foo == 1');

    Source

    1.  <div class='else-if'><node1/></div>

    Result

    1.  <?php
    2.  else if ($foo == 1{
    3.  ?><node1/><?php
    4.  }
    5.  ?>




    Tags:

    access:  public


    Parameters:

    string   $code   Valid PHP condition code

    [ Top ]

    method tagToElseIfVar [line 332]

    QueryTemplatesParse|QueryTemplatesPhpQuery tagToElseIfVar( string $var)

    Replaces selected tag with PHP "else if" statement checking if $var evaluates to TRUE. $var must be available inside template's scope.

    $var is passed in JavaScript object notation (dot separated).

    Method doesn't change selected nodes stack. detached from it's parent.

    Notice-safe.

    == Example ==

    === Markup ===

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

    === Data ===

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

    === `QueryTemplates` formula ===

    1.  $template['div:eq(1)']->
    2.      tagToElseIfVar('data.foo.bar.0')
    3.  ;

    === Template ===

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

    === Template tree before ===

    1.  div
    2.   - Text:1
    3.  div
    4.   - Text:2
    5.  div
    6.   - Text:3

    === Template tree after ===

    1.  div
    2.   - Text:1
    3.  PHP
    4.  Text:2
    5.  PHP
    6.  div
    7.   - Text:3




    Tags:

    see:  QueryTemplatesPhpQuery::ifVar()
    access:  public


    Parameters:

    string   $var   Dot-separated object path, eg Object.property.inneProperty

    [ Top ]

    method tagToElsePHP [line 426]

    void tagToElsePHP( )



    Tags:

    access:  public


    [ Top ]

    method tagToElseStatement [line 423]

    void tagToElseStatement( )



    Tags:

    access:  public


    [ Top ]

    method tagToIfNotVar [line 207]

    QueryTemplatesParse|QueryTemplatesPhpQuery tagToIfNotVar( string $var)

    Replaces selected tag with PHP "if" statement checking if $var evaluates to FALSE. $var must be available inside template's scope.

    $var is passed in JavaScript object notation (dot separated).

    Method doesn't change selected nodes stack. detached from it's parent.

    Notice-safe.

    == Example ==

    === Markup ===

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

    === Data ===

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

    === `QueryTemplates` formula ===

    1.  $template['div:eq(1)']->
    2.      tagToIfNotVar('data.foo.bar.0')
    3.  ;

    === Template ===

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

    === Template tree before ===

    1.  div
    2.   - Text:1
    3.  div
    4.   - Text:2
    5.  div
    6.   - Text:3

    === Template tree after ===

    1.  div
    2.   - Text:1
    3.  PHP
    4.  Text:2
    5.  PHP
    6.  div
    7.   - Text:3




    Tags:

    see:  QueryTemplatesPhpQuery::ifVar()
    access:  public


    Parameters:

    string   $var   Dot-separated object path, eg Object.property.inneProperty

    [ Top ]

    method tagToIfPHP [line 41]

    QueryTemplatesParse|QueryTemplatesPhpQuery tagToIfPHP( string $code)

    Replaces selected tag with PHP "if" statement containing $code as condition.

    Method doesn't change selected nodes stack. detached from it's parent.

    Example

    1.  $template['.if']->tagToIfPHP('$foo == 1');

    Source

    1.  <div class='if'><node1/></div>

    Result

    1.  <?php
    2.  if ($foo == 1{
    3.  ?><node1/><?php
    4.  }
    5.  ?>




    Tags:

    access:  public


    Parameters:

    string   $code   Valid PHP condition code

    [ Top ]

    method tagToIfVar [line 126]

    QueryTemplatesParse|QueryTemplatesPhpQuery tagToIfVar( string $var)

    Replaces selected tag with PHP "if" statement checking if $var evaluates to TRUE. $var must be available inside template's scope.

    $var is passed in JavaScript object notation (dot separated).

    Method doesn't change selected nodes stack. detached from it's parent.

    Notice-safe.

    == Example ==

    === Markup ===

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

    === Data ===

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

    === `QueryTemplates` formula ===

    1.  $template['div:eq(1)']->
    2.      tagToIfVar('data.foo.bar.0')
    3.  ;

    === Template ===

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

    === Template tree before ===

    1.  div
    2.   - Text:1
    3.  div
    4.   - Text:2
    5.  div
    6.   - Text:3

    === Template tree after ===

    1.  div
    2.   - Text:1
    3.  PHP
    4.  Text:2
    5.  PHP
    6.  div
    7.   - Text:3




    Tags:

    see:  QueryTemplatesPhpQuery::ifVar()
    access:  public


    Parameters:

    string   $var   Dot-separated object path, eg Object.property.inneProperty

    [ Top ]

    method _if [line 479]

    void _if( $lang, $code, [ $separate = false])



    Tags:

    access:  public


    Parameters:

       $lang  
       $code  
       $separate  

    [ Top ]

    method _tagToElse [line 429]

    void _tagToElse( $lang)



    Tags:

    access:  public


    Parameters:

       $lang  

    [ Top ]


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