PHP code block inject for QueryPath.
Switch branches/tags
Nothing to show
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
src/QueryPath/Extensions
test/QueryPath/Extensions
.gitignore
README.md
composer.json
phpunit.xml.dist

README.md

QPPHP

PHP code block inject for QueryPath.

QueryPath is a PHP library for manipulating XML and HTML. https://github.com/technosophos/querypath

Install

  • Please refer QueryPath installation.

  • And copy src/QueryPath/Extensions/QPPHP.php to your source tree from git repository.

  • At last, include copied file, like followings:

    require_once 'QueryPath/Extensions/QPPHP.php';

Inject PHP code

Extended methods allows placing PHP code inside DOM.

  • attrPHP($attr, $code)
    • inject: attr($attr, "")
  • beforePHP($code)
    • inject: before("")
  • afterPHP($code)
    • inject: after("")
  • prependPHP($code)
    • inject: prepend("")
  • appendPHP($code)
    • inject: append("")
  • wrapAllPHP($codeBefore, $codeAfter)
    • inject: wrapAll("")
  • wrapPHP($codeBefore, $codeAfter)
    • inject: wrap("")
  • wrapInnerPHP($codeBefore, $codeAfter)
    • inject: wrapInner("")
  • replaceWithPHP($code)
    • inject: replaceWith("")

Output PHP code

Code injected with extended methods above won't be returned using original output methods such as html(). To make it work, php method have to be used.

  • php()
    • inject & replace: html()