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

    I was thinking that since [[Widgets]] and [[$Templates]] supports parameters why not let [[*ContentFields]] supports the same? So I came up with this format:

    [[*ContentField? &param=`value`]]

    This can be very useful when working with @Bindings as sugested by Jason. For example:

    @SELECT * FROM [+PREFIX+]site_content WHERE pagetitle=’[+param+]’

    Another thing came to mind is the ability to invoke methods on a Widget or a ContentField. As you know CFs as well as Widgets will support methods and events.


    [[*ContentField? &param=`value` &*=`toBold,toUpper` ]]

    The &* param is used to represent a comma delimitted list functions to be invoked after processing the CF. These methods can then work on the output of the CF


    [[Widget? &*=`drawBox` &color=`#c0c0c0`]]

    The above will invoke the drawBox method after executing the widget. The method can then work on the output of the Widget.


    Samples:
    [[Widget? &param=`value` ]]

    [[$Template? &param=`value` ]]

    [[*ContentField? &param=`value` &*=`toText` ]]

    [[Widget? &*=`drawbox` &color=`#fff`]]


    What do you think? Good idea or bad idea? Any other suggessions?

      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
      I think it’s really a pretty cool idea that just might let folks emulate working in MODx as they do in just about any other system around. smiley

        Ryan Thrash, MODX Co-Founder
        Follow me on Twitter at @rthrash or catch my occasional unofficial thoughts at thrash.me
        • 32963
        • 1,732 Posts
        Quote from: rthrash at Dec 13, 2005, 01:54 PM

        I think it’s really a pretty cool idea that just might let folks emulate working in MODx as they do in just about any other system around. smiley

        Cool.

        What do you think about the format &*=`MethodName`? Good or too confusing?

        These other formats came to mind:

        &|=`MethodName`
        &#=`MethodName`

        Got any more?


          xWisdom
          www.xwisdomhtml.com
          The fear of the Lord is the beginning of wisdom:
          MODx Co-Founder - Create and do more with less.
          • 1764
          • 680 Posts
          Too cool. It would be awesome to see this all working.

          What about

          &!=`MethodName`

          or even just &!`MethodName` if it wasn’t a hassle for the parser.

          Some MS programs use a ! to symbolize execution.
            • 25663 MODX Staff
            • 12,272 Posts
            I like &* simply from the speed and proximity when typing.

            There’s also &+, which is above the equal sign, and sorta means "figure this out, then add these behaviors to it".

              Ryan Thrash, MODX Co-Founder
              Follow me on Twitter at @rthrash or catch my occasional unofficial thoughts at thrash.me
              • 25663 MODX Staff
              • 12,272 Posts
              This would be a lot like what Wordpress does with it’s filters, right?

              Would be handy for an almost infinite number of things, or give folks an alternate way to do them over a plugin. Filtering out bad words, styling. Transforming site content, etc. Cool!
                Ryan Thrash, MODX Co-Founder
                Follow me on Twitter at @rthrash or catch my occasional unofficial thoughts at thrash.me