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
    Quote from: rthrash at Oct 06, 2006, 03:29 PM

    By the way, there are only three files needed from Raymond’s branch if you’d like to test it (the rest are now in trunk):

    includes/
    document.parser.class.inc.php
    extenders/
    parser.class.php
    parser.helper.inc.php


    Thanks Ryans. In addition you’ll also need the debug icons (optional) located at media/debug
      xWisdom
      www.xwisdomhtml.com
      The fear of the Lord is the beginning of wisdom:
      MODx Co-Founder - Create and do more with less.
      • 25663 MODX Staff
      • 12,272 Posts
      Those were committed already ... tongue
        Ryan Thrash, MODX Co-Founder
        Follow me on Twitter at @rthrash or catch my occasional unofficial thoughts at thrash.me
        • 6726
        • 7,075 Posts
        Quote from: xwisdom at Oct 06, 2006, 03:06 PM
        I too would not expect the parser to be release in 095 as it’s still in beta but I’m hoping to release a public beta somtime next week with a some unit testing so that it can be easily tested within other environments.

        Great news Raymond, I am sure there will be a lot of excitement around this beta !
        I didn’t think the cache issues would be solved in such a short period of time, really amazing smiley
          .: COO - Commerce Guys - Community Driven Innovation :.


          MODx est l'outil id
          • 4195
          • 398 Posts
          Hi Raymond,

          Can you take a look at PHx (http://modxcms.com/forums/index.php/topic,7522.0.html) .
          With this plugin i’m extending the current (old) document parser to be able to process certain variables (like placeholders, document variables, setting variables etc..) to easily format/change their output. I’m also touching conditional processing (but you already fixed that in new parser). I really would like the possibility to just add a modifier to a variable (in the way PHx does) in the new parser.

          This is just my personal view but I really would like to discuss the subject smiley
            Armand Pondman
            MODx Coding Team
            :: Jot :: PHx
            • 6726
            • 7,075 Posts
            That would be really great bS ! I love the features introduced with PHx... I guess modifiers could be added on top of filters (another great addition, btw)...
              .: COO - Commerce Guys - Community Driven Innovation :.


              MODx est l'outil id
              • 22303 MODX Staff
              • 10,725 Posts
              Quote from: bS at Oct 09, 2006, 03:17 AM

              Hi Raymond,

              Can you take a look at PHx (http://modxcms.com/forums/index.php/topic,7522.0.html) .
              With this plugin i’m extending the current (old) document parser to be able to process certain variables (like placeholders, document variables, setting variables etc..) to easily format/change their output. I’m also touching conditional processing (but you already fixed that in new parser). I really would like the possibility to just add a modifier to a variable (in the way PHx does) in the new parser.

              This is just my personal view but I really would like to discuss the subject smiley

              Yes, let’s discuss this in-depth, because input and output filters for any element, as well as modifiers for formatting any object variable using various techniques, and with intelligence (i.e. based on data type used in the database), are already a part of the changes in the code and database for 1.0 (the modifiers are a part of xPDO itself and usable now), but have nothing to do with the parser itself. And this IMO is the way it should stay. Otherwise, we’re right back to encouraging a chaotic mix of presentation and logic.

              This is the same feeling I have about conditional tags, and beg that they be removed from this parser and implemented as simple add-ons as they should be.
                • 6726
                • 7,075 Posts
                Let me react to this as the layman that I am...

                If I understand correctly, that would mean conditionnal testing, filters and modifiers would happen before the document is even parsed ? Directly during data retrieval from the DB ?

                I do understand why filters and modifiers would be processed that way, but I have more trouble understanding the concept for conditionnal testing. Would it mean conditionnal testing would be somewhat like using @EVAL for a TV ?

                What would it mean from a designer’s perspective ? Do you have an example of what steps or code would be needed to achieve the same things the new parser is doing now (I confess I am curious !) ?

                That’s a lot of questions, I realize... Personnally, what I like about conditionnal tags is you can build things in the context of a template. Not to mention tags are html-like which is nice for designers tongue
                  .: COO - Commerce Guys - Community Driven Innovation :.


                  MODx est l'outil id
                  • 4195
                  • 398 Posts
                  Quote from: OpenGeek at Oct 09, 2006, 10:11 AM

                  Yes, let’s discuss this in-depth, because input and output filters for any element, as well as modifiers for formatting any object variable using various techniques, and with intelligence (i.e. based on data type used in the database), are already a part of the changes in the code and database for 1.0 (the modifiers are a part of xPDO itself and usable now), but have nothing to do with the parser itself. And this IMO is the way it should stay. Otherwise, we’re right back to encouraging a chaotic mix of presentation and logic. This is the same feeling I have about conditional tags, and beg that they be removed from this parser and implemented as simple add-ons as they should be.

                  1.0 >:
                  I want to take 1.0 out of the discussion, we know everything will be better then smiley

                  pre-1.0:
                  I agree to the fact that the conditionals and the modifiers should be a seperate add-on/plugin, the only thing i’m concerned about is all the rogue templating solutions (like my own) popping up. There’s no default solution that will allow a acceptable degree of freedom for designers. All snippet developers are creating their own templating solution or the templating involves using many small snippets to get things done.. and that makes it very frustrating for the average user. The issue with conditionals are now generally solved by putting them in your snippet code, thus in many cases limiting the designer and creating ’unneeded’ extra code for the snippet author.

                  If we go with the templating by add-on/plugin solution please point the MODx community into the same direction of how to do this. And IMO the way it’s done now (limiting design + overhead in snippet code) is not very attractive. I stuck with MODx because I know what is possible with a little extra coding (as a coder), but think of all the people who hate touching code but do know how to spice a site up and they get hit in the face by the way MODx limits their view.
                    Armand Pondman
                    MODx Coding Team
                    :: Jot :: PHx
                    • 22303 MODX Staff
                    • 10,725 Posts
                    Quote from: bS at Oct 09, 2006, 11:10 AM

                    1.0 >:
                    I want to take 1.0 out of the discussion, we know everything will be better then smiley
                    Absolutely not; nothing will be better then if we don’t make it part of the discussion. IMO, nothing is more important to this project’s future than paving a smooth path from where we are to where we are going. Without that part of the discussion, there is no common vision or goal to achieve, and the solutions we come up with will be inconsistent, and could potentially lead us in directions future releases would never be able support, or to confusing changes in how to approach specific problems with implied MODx best practices (implied by implementation of existing components).

                    Quote from: bS at Oct 09, 2006, 11:10 AM

                    pre-1.0:
                    I agree to the fact that the conditionals and the modifiers should be a seperate add-on/plugin, the only thing i’m concerned about is all the rogue templating solutions (like my own) popping up. There’s no default solution that will allow a acceptable degree of freedom for designers. All snippet developers are creating their own templating solution or the templating involves using many small snippets to get things done.. and that makes it very frustrating for the average user. The issue with conditionals are now generally solved by putting them in your snippet code, thus in many cases limiting the designer and creating ’unneeded’ extra code for the snippet author.

                    If we go with the templating by add-on/plugin solution please point the MODx community into the same direction of how to do this. And IMO the way it’s done now (limiting design + overhead in snippet code) is not very attractive. I stuck with MODx because I know what is possible with a little extra coding (as a coder), but think of all the people who hate touching code but do know how to spice a site up and they get hit in the face by the way MODx limits their view.
                    First, I still see no reason to add any templating features to the MODx parser. The thing that sold me on MODx was the simple approach to templating it took, and the profound way it encouraged me as a developer to break down the logic and presentation into small, manageable parts, in whatever way was best for the stakeholders of the site I am working on. I’ve done this quite successfully without adding any additional parsing overhead to MODx. It’s just a matter of organization and planning the interface so less-technical users can easily modify just the parts they want to be able to without messing up the rest.

                    I would venture to say the only real problem here is the inability to easily import/export groups of related components together, including example pages on which the components are implemented as an example of usage. With this feature, I think the model of using many small components is best solution, and is exactly what I’m trying to achieve. Modularity. Re-use. Loose-coupling. These are all important concepts of extensibility and interaction between components; with very clear and specific purposes, and without a zillion configuration options, MODx can encourage each component to be more efficient and allows it to focus on doing a single task, and doing it extremely well.

                    Quote from: davidm at Oct 09, 2006, 10:40 AM

                    If I understand correctly, that would mean conditionnal testing, filters and modifiers would happen before the document is even parsed ? Directly during data retrieval from the DB ?
                    No, it simply means there are methods already available as part of the xPDO core API that allow you to use modifiers/filters to format the data in various ways, based on what type of data it is (string, int, float, datetime, timestamp, date, enum, etc.). And using those API methods to create generic components that can allow designers to easily add/change/remove the modifiers is trivial.

                    Quote from: davidm at Oct 09, 2006, 10:40 AM

                    I do understand why filters and modifiers would be processed that way, but I have more trouble understanding the concept for conditionnal testing. Would it mean conditionnal testing would be somewhat like using @EVAL for a TV ?
                    No, it simply means there would not be a dedicated tag syntax for conditionals. Condition behavior can easily be achieved by creating a snippet for each kind of conditional logic you want to apply, e.g.
                    [[IF-ELSE? &if=`[[IsMember? &group=`foo`]]` &do=`[[foo]]` &else=`[[$bar]]`]]

                    This will test the if result of IsMember and if true, execute the snippet `foo`, else output the content of the `bar` chunk. You can create snippets like this, with a great deal of flexibility and control, to handle just about any conditional logic anyone can think of. And most importantly I think, it can be easily customizable for individual deployments by simply modifying a snippet, instead of changing something in the parser.

                    Likewise, with the modifiers/formatters, you can easily do something like this with xPDO and a couple of very simple snippets:
                    [[MyOnlineReport? &reportMode=`card`]]
                    
                    <p style="postion: absolute; top:10px; left: 100px;width:600px;color:#000;font-size:86%;font-weight:bold">Click your data to go to the edit page.</p>
                    <p style="postion: absolute; top:10px; left: 450px;width:200px;font-size:86%;"><a href="[+xReferrer.href+]">Return to previous page</a></p>
                    
                    <div id="pvwName">
                      [[xGet? &objClass=`Person` &fields=`first_name||middle_name||last_name` &tpl=`MyOnlineReport.person`]]
                    </div>
                    
                    <div id="pvwID">
                      [[xGet? &objClass=`Person` &fields=`member_id,re:/([A-Z0-9]{3})([A-Z0-9]{4})([A-Z0-9]{3})/,$1-$2-$3` &tpl=`MyOnlineReport.member`]]
                    </div>
                    
                    <div id="pvwAddress" onclick="window.location='[~82~]'" class="editable">
                      [[xGet? &objClass=`Address` &objKey=`address` &fields=`street||city||state||zip` &tpl=`MyOnlineReport.address`]]
                    </div>
                    
                    <div id="pvwExp">
                      [[xGet? &objClass=`Member` &objKey=`member` &fields=`expire_date,%m/%d/%y` &tpl=`Preview.expires`]]
                    </div>
                    
                    <div id="pvwPhone" onclick="window.location='[~82~]'" class="editable">
                      [[xGet? &objClass=`Phone` &objKey=`primary_phone` &fields=`number`]]
                    </div>
                    
                    <div id="pvwAllergies" onclick="window.location='[~61~]'" class="editable">
                      [[xGet? &objClass=`Allergy` &fields=`type` &tpl=`MyOnlineReport.allergy-pvw`]]
                    </div>
                    
                    <div id="pvwAlert" onclick="window.location='[~60~]'" class="editable">
                      [[xGet? &objClass=`MedAlert` &fields=`alert`  &tpl=`MyOnlineReport.med_alert-pvw`]]
                    </div>
                    
                    <div id="pvwBlood" onclick="window.location='[~82~]'" class="editable">
                      [[xGet? &objClass=`Person` &fields=`blood_type` &tpl=`Preview.blood_type`]]
                    </div>
                    

                    This is an example from one of the first sites I deployed using xPDO. I created a snippet (`MyOnlineReport`) which retrieves all the data for the report. Then I created xGet to be able to manage the output from the various data objects on a per page basis, using formatting modifiers based on the xPDO API, as well as chunks serving as templates in which to place the output. In this way, I can create totally different views of the same data, using the same snippets with only slightly different parameters. The same thing could be done for simple db result sets with a slightly different version of this sample xGet snippet.

                    Quote from: davidm at Oct 09, 2006, 10:40 AM

                    What would it mean from a designer’s perspective ? Do you have an example of what steps or code would be needed to achieve the same things the new parser is doing now (I confess I am curious !) ?

                    That’s a lot of questions, I realize... Personnally, what I like about conditionnal tags is you can build things in the context of a template. Not to mention tags are html-like which is nice for designers tongue
                    Right, nothing different there. Slightly different tag syntax is all. Consistent with the rest, and simple.
                      • 22815
                      • 1,097 Posts
                      *My* concern is with things like:
                      <div id="pvwAddress" onclick="window.location='[~82~]'" class="editable">
                        [[xGet? &objClass=`Address` &objKey=`address` &fields=`street||city||state||zip` &tpl=`MyOnlineReport.address`]]
                      </div>

                      where I don’t actually want to output a div if that snippet isn’t going to return anything, but also I don’t want to specify the div in the snippet template because I may wish to use different variants on different layouts.

                      And I fail to see how shunting stuff off to a snippet to do an IfElse is any less a chaotic mix of logic and presentation from the point of view of the user. Sure, it protects the purity of the parser, but it looks like a workaround.

                      Quote from: OpenGeek at Oct 09, 2006, 11:49 AM

                      I would venture to say the only real problem here is the inability to easily import/export groups of related components together, including example pages on which the components are implemented as an example of usage. With this feature, I think the model of using many small components is best solution, and is exactly what I’m trying to achieve. Modularity. Re-use. Loose-coupling. These are all important concepts of extensibility and interaction between components; with very clear and specific purposes, and without a zillion configuration options, MODx can encourage each component to be more efficient and allows it to focus on doing a single task, and doing it extremely well.
                      You’ve gone off on a tangent there. It all sounds great and positive, but this masks the fact that you’re basically saying "No". You’ve redefined the problem, and then just said "With this solved..", and argued the case *for* each snippet having its own different templating system (whatever is most efficient for that component).

                      Importing and exporting related components is *not* the only real problem. The bigger issue is the wildly different templating formats that users must learn. Many will assume the first one they come across, be it Ditto or Wayfinder, will be the "official" way to do it. Re-use of skills - that’s useful.

                      So, what is the best future-proof way to achieve what bS talks about?
                        No, I don&#39;t know what OpenGeek&#39;s saying half the time either.
                        MODx Documentation: The Wiki | My Wiki contributions | Main MODx Documentation
                        Forum: Where to post threads about add-ons | Forum Rules
                        Like MODx? donate (and/or share your resources)
                        Like me? See my Amazon wishlist
                        MODx "Most Promising CMS" - so appropriate!