We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 32963
    • 1,732 Posts
    Hi,

    I’ve discover that there are two types of parsing that can be done with the new Parser.

    The first "Early Parsing" is done in one clean sweep of the source. The [[Widget]] will set the value of [[+Placeholder]] to [[AnotherWidget]]. In this situation all tags are parsed in one call.

    example:
    [[Widget]]
    [[+Placeholder]]

    Late Parsing - this is done when a widget or Content Field sets the value of a placeholder to output a tag after that placeholder has already been processed. In this situation [[Widget]] sets the value of the [[+Placeholder]] to [[AnotherWidget]]

    [[+Placeholder]]
    [[Widget]]
    The parser will ignore the [[+Placeholder]] on the first sweep then process the [[Widget]]. At the end of parsing the source it will then replace [[+Placholder]] with the assigned value. At this stage there’s a [[AnotherWidget]] inside the source.

    How do we handle this situation? Should we reparse the source or just document it so that users will be aware of the two types of parsing?

    The thing to note here is that placeholders can be placed anywhere inside a document.
      xWisdom
      www.xwisdomhtml.com
      The fear of the Lord is the beginning of wisdom:
      MODx Co-Founder - Create and do more with less.
      • 22303 MODX Staff
      • 10,725 Posts
      Not sure if we should reparse the source or not, but I’m interested in the behavior of TV’s in this scenario. I often embed calls to widgets within TV’s, and these widgets often have other widgets and placeholders within them. Would the new parser handle this, since it is not recursive and only has the early and late stages?
        • 32963
        • 1,732 Posts
        The new Parser uses recursive calling techniue to support nested calls.

        It’s ok to nest [[Widgets]] and other [[+Placholders]] inside a [[*ContentField]]. The parser will see these tags and process them. The problem only occurs when you set the value of a placholder to output a [[Widget]]

        example:
        // code for the [[Widget]] 
        // shown above in the late parsing example
        $cms->setPlacholder('MyContent','[[AnotherWidget]]');


        I’ll give this some more thought in time to come. But for now it’s not a show stopper
          xWisdom
          www.xwisdomhtml.com
          The fear of the Lord is the beginning of wisdom:
          MODx Co-Founder - Create and do more with less.