<![CDATA[ Snippets execute in wrong order when pdoTools is installed - MODX Community Forums]]> https://forums.modx.com/thread/?thread=101053 <![CDATA[Snippets execute in wrong order when pdoTools is installed]]> https://forums.modx.com/thread/101053/snippets-execute-in-wrong-order-when-pdotools-is-installed#dis-post-545583
The Placeholder value is set by a snippet eg. [[regFile? &item=`file1`]]. Each time the snippet is called the value passed by &item is concatenated to the previous value and stored in the placeholder.

Calling [[regFile? &item=`file1,file3`]] then calling [[regFile? &item=`file7`]] results in [[+myPlaceholder]] being set to: file1,file3,file7

So far so good.

At the end of my Template a second snippet [[outputScripts]] is called. It parses myPlaceholder and returns an HTML block with script tags based on the files stored in the Placeholder eg.

<script src="file1.js"></script>
<script src="file3.js"></script>
<script src="file7.js"></script>

However when placed at the end of my Template it returns

<script src="file1.js"></script>
<script src="file3.js"></script>

If I change the [[regFile]] snippet to output the current Placeholder value each time it is called the Placeholder value is correct, after the second call the 3 .js files are included.

If both snippets also output the current microtime() you can see that [[outputScripts]] is called before [[regFile]] even though [[outputScripts]] is the last tag in my Template. To illustrate:

0.624 [[regFile]]
0.911 [[regFile]]
0.896 [[outputScripts]] <<< this should be the 3rd event but the timer shows it is the 2nd.

I don't know why but calling [[!outputScripts]] uncached while pdoTools is installed also resolves the issue.

Changing the System Setting for pdotools_fenom_default to No has no effect (I don't think it should though, I think this relates to the way pdoTools snippets handle Chunks).

Disabling the pdoTools Plugin has no effect.

Can anyone suggest what might be the cause or how I can investigate further?

The issue seems vaguely similar to the Placeholder issue which was influenced by pdoTools reported at https://www.bountysource.com/issues/33123926-issue-defined-placeholders-have-to-be-uncached-in-order-to-use-output-modifiers-in-2-4-4]]>
chris.dempsey78 Oct 11, 2016, 01:54 AM https://forums.modx.com/thread/101053/snippets-execute-in-wrong-order-when-pdotools-is-installed#dis-post-545583
<![CDATA[Re: Snippets execute in wrong order when pdoTools is installed (Best Answer)]]> https://forums.modx.com/thread/101053/snippets-execute-in-wrong-order-when-pdotools-is-installed#dis-post-549166
pdoParser

  • parser_class: pdoParser
  • parser_class_path: {core_path}components/pdotools/model/pdotools/

modParser

  • parser_class: modParser
  • parser_class_path: {core_path}model/modx/

]]>
chris.dempsey78 Mar 04, 2017, 05:38 PM https://forums.modx.com/thread/101053/snippets-execute-in-wrong-order-when-pdotools-is-installed#dis-post-549166
<![CDATA[Re: Snippets execute in wrong order when pdoTools is installed]]> https://forums.modx.com/thread/101053/snippets-execute-in-wrong-order-when-pdotools-is-installed#dis-post-549161
Could you please post the right settings in this case?

parser_class: ...
parser_class_path: ...

]]>
gadgetto Mar 04, 2017, 03:25 PM https://forums.modx.com/thread/101053/snippets-execute-in-wrong-order-when-pdotools-is-installed#dis-post-549161
<![CDATA[Re: Snippets execute in wrong order when pdoTools is installed (Best Answer)]]> https://forums.modx.com/thread/101053/snippets-execute-in-wrong-order-when-pdotools-is-installed#dis-post-545604
Snippets are now executed in the order they appear.]]>
chris.dempsey78 Oct 11, 2016, 09:03 PM https://forums.modx.com/thread/101053/snippets-execute-in-wrong-order-when-pdotools-is-installed#dis-post-545604
<![CDATA[Re: Snippets execute in wrong order when pdoTools is installed]]> https://forums.modx.com/thread/101053/snippets-execute-in-wrong-order-when-pdotools-is-installed#dis-post-545599 placeholderAssets.

Having read more of the pdoTools documentation I think this section describes the behaviour: https://docs.modx.pro/en/components/pdotools/parser#Placeholders-filling

But I couldn't figure how to adjust my code. Looking again I must not have had pdotools_fenom_parser enabled.

Need to try again as I could use a speed boost by being able to use [[!pdoResources]] on the site I'm working on.

There's mention over on the Slack Channel of a System Setting to select whether to use the pdoTools parser or the MODX parser. I did look for this last night, there are around a dozen system settings for pdoTools but I don't remember one to select between parsers.

The translation of the Russian documentation does say
pdoParser and if enabled in the system settings
which reads like the parser can be chosen. I'll go install pdoTools again because I can't see a list of System Settings in the documentation just now.]]>
chris.dempsey78 Oct 11, 2016, 07:29 PM https://forums.modx.com/thread/101053/snippets-execute-in-wrong-order-when-pdotools-is-installed#dis-post-545599
<![CDATA[Re: Snippets execute in wrong order when pdoTools is installed]]> https://forums.modx.com/thread/101053/snippets-execute-in-wrong-order-when-pdotools-is-installed#dis-post-545596 BobRay Oct 11, 2016, 06:35 PM https://forums.modx.com/thread/101053/snippets-execute-in-wrong-order-when-pdotools-is-installed#dis-post-545596