Answer the question
In order to leave comments, you need to log in
Which way is faster with FENOM? loops or snippets?
Friends, I started to study FENOM, templates in files, etc., I understand and really faster, I saw a comparison of the parser table, that with a large number of parser FENOM is still faster, albeit a little, but I can’t understand one thing, faster through the snippet, or directly faster through foreach?
How fast so
{'!getImageList' | snippet : [
'tpl' => 'tpl.addressl',
'tvname' => 'address',
'docid' => $id,
]}
{set $address = json_decode($id | resource : 'address', true)}
{if $address}
{foreach $address as $item}
{$item.title}
{/foreach}
{/if}
{set $items = $_modx->runSnippet('!pdoMenuFenom', [
'parents' => 0,
'displayStart' => true,
'toArray' => true,
])}
{foreach $items as $item}
{$item['level']}
{/foreach}
Answer the question
In order to leave comments, you need to log in
Faster through fenom, option 1 is no longer needed.
By and large, there is no difference from the second and third, except that in the second it is clearly possible to influence the non-shielding. in the third variant it is necessary to add to this account.
The fourth offhand is a little slower than the third, because still the chunk is tightened.
Yes, you can test it yourself, measure the time, you only need a lot of data in migx.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question