We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 6661
    • 119 Posts
    But why not just borrow the syntax from Smarty?

    [*pageTitle|upper*]
    [*pageTitle|truncate:40:"..."*]

    Using date_format to format the date:
    [*published|date_format:"%Y/%m/%d"*]

    I think you'd want to be able to stack them, too:
    [*pagetitle|upper|truncate:40:"..."*]

    I actually really like this, the pipe symbol kind of drives home that the output of the TV is going to be filtered/piped in to the function. Also, chaining or stacking them is a great idea as well.
      • 32963
      • 1,732 Posts

      I actually really like this, the pipe symbol kind of drives home that the output of the TV is going to be filtered/piped in to the function. Also, chaining or stacking them is a great idea as well.

      Thanks dave,

      Well that's two up for this format. Anyone else up for this format?

      One thing though is this case how can we tell a function from a property?

      [*pagetitle|upper*] could be assumed to be a function but what if it's property or the TVO? I'm all for functions only. So we can ignore the properties of the TVO for example, [*pagetitle:length*] where length is a function of the pagetitle TVO. Agree?

      IMO, I think this syntax:

      [*pagetitle|upper|truncate(40,"...")*]

      would be much faster to parse and execute than:

      [*pagetitle|upper|truncate:40:"..."*]

      Using truncate(40,"...") - php style would eliminate the extra step of having to break up truncate:40:"..."

      Btw, I'll be looking for a very very fast and efficient way to parse the new TVO with the smarty syntax. Anyone got any such functions hanging around?
        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
        After some more thought, reflection, and understanding of a few more existing MODx features, let's take a step back before we decide to become a Smarty do-alike, though that might be another plug-in idea, to support smarty templates.

        First, my initial suggestion of TVO's consisted of two parts, data providers and object usage. In regards to data providers, I believe this is something we can address in conjunction with the subject of data repository abstraction. This way, we can address the existing templating mechanisms, API's, and core data storage with one code base. A tight, focused object abstraction layer. If something already exists like this, perhaps we can utilize that; I'll be researching this.

        Second, after learning about Placeholders today, we already have everything we need to access TVO's from the templates, except for the "navigation" of our object taxonomies. And if we can use one, easy to use "navigation" language for access to TVO's from the templates, API's and core, well, that would keep everything as tight as it already is.

        In this sense, we would be turning the existing infrastructure elements, such as content, snippets, chunks, etc. into core taxonomy objects. There is internal and external data access, standardized, organized, and abstracted from any kind of repository.

        That would allow for a standard format to be defined regarding import/export of specific taxonomies in whatever format we decide. I like XML/XLST for this, cause you can upgrade XML structured documents very easily with XSLT.

        In regards to the syntax for the navigation, I'm in no way wanting to control this, but another thought is to allow configurable delimeters, in addition to standard PHP object syntax. Could plugins be utilized to filter such syntax on the front-end (e.g. template tags, API calls)? On the back-end (under the API hood), the standard syntax might suffice.

        Just some more thoughts on this topic.
          • 34017
          • 898 Posts
          I am bringing up some old posts. Any update on your ideas/implementations on this?

          Chuck
            Chuck the Trukk
            ProWebscape.com :: Nashville-WebDesign.com
            - - - - - - - -
            What are TV's? Here's some info below.
            http://modxcms.com/forums/index.php/topic,21081.msg159009.html#msg1590091
            http://modxcms.com/forums/index.php/topic,14957.msg97008.html#msg97008
            • 32963
            • 1,732 Posts
            Well as far as I’m concern I think it’s still on the list of things to do. In 1.0 things will function a little different but you should be able to produce the same results.
              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
              See my rantings on MVC here, and substitute Content Element for Template Object, for some related recent ideas on the subject in relation to what’s coming.