Created
February 5, 2016 19:43
-
-
Save vgrish/2530a0364bf49b05481f to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
echo "<pre>"; | |
$modx->switchContext('web'); | |
$modx->invokeEvent('OnHandleRequest'); | |
if (!$twiggy = $modx->getService('twiggy', 'twiggy', $modx->getOption('twiggy_core_path', null, $modx->getOption('core_path') . 'components/twiggy/') . 'model/twiggy/')) { | |
return 'Could not load twiggy class!'; | |
} | |
$tpl = " | |
{% set q = modx.newQuery('modResource') %} | |
{% set ok = q.select(['modResource.*']) %} | |
{% set ok = q.limit('4000') %} | |
{% set s = q.prepare() %} | |
{% set ok = s.execute() %} | |
{% for resource in s.fetchAll(2) %} | |
<p>{{ resource.id }} - {{ resource.menuindex }} - {{ resource.createdon }} - {{ resource.publishedon }}</p> | |
{% endfor %} | |
{{ getInfo() }} | |
"; | |
$output = $twiggy->process($tpl, array(), false); | |
print_r($output); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
totalTime : 0.1909 s
queryTime : 0.0011 s
phpTime : 0.1898 s
queries : 3
source : cache