We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 5160
    • 118 Posts
    I have a fresh install of MODX 2.5.1 with a few Extras installed including pdoTools. Something odd is going on with the value being output for a Placeholder. The issue is resolved by uninstalling pdoTools.

    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

    This question has been answered by multiple community members. See the first response.

      • 3749
      • 24,544 Posts
      What is the actual name of your placeholder? What you're describing sounds like something that would happen if a placeholder had the same name as a resource field or TV.
        Did I help you? Buy me a beer
        Get my Book: MODX:The Official Guide
        MODX info for everyone: http://bobsguides.com/modx.html
        My MODX Extras
        Bob's Guides is now hosted at A2 MODX Hosting
        • 5160
        • 118 Posts
        Placeholder is named 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.
        • discuss.answer
          • 5160
          • 118 Posts
          Issue resolved by changing the default pdoTools system settings parser_class and parser_class_path to use the MODX parser.

          Snippets are now executed in the order they appear.
            • 10378
            • 375 Posts
            @chris.dempsey78:

            Could you please post the right settings in this case?

            parser_class: ...
            parser_class_path: ...

              Freelancer @bitego http://www.bitego.com
              ---
              GoodNews - one of the most advanced and integrated Group Mailer premium add-ons for MODX Revolution!
              More infos here: http://www.bitego.com/extras/goodnews/
            • discuss.answer
              • 5160
              • 118 Posts
              From my notes, the parser_class settings including paths are:

              pdoParser

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

              modParser

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