We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 13730
    • 149 Posts
    Modx 2.2
    getResources : 1.4.2

    TV name : eventDate (type = date)

    Snippet for display a date in french :
    [[!date-fr? &tv=`[[*eventDate]]`]]

    Output example : Mardi, 10 janvier 2012

    Chunk name : evenements
    <div class="activite">
    <h2 class="eventsTitre">[[+pagetitle]]</h2>
    <h3 class="eventsDate">[[!date-fr? &tv=`[[*eventDate]]`]] à [[+tv.eventVille]]</h3>
    [[+content]]
    </div>


    getResources call
    [[!getResources? &parents=`16` &tpl=`evenements` &processTVs=`0` &includeTVs=`1` &sortby=`menuindex` &sortdir=`ASC` &includeContent=`1`]]


    I have a problem with the eventDate TV in my chunk. If I write my snippet call in my chunk like this
     [[!date-fr? &tv=`[[*eventDate]]`]]
    the TV is not process, all the dates in my listing are the same ex: Mercredi 31 décembre 1969.

    To see if my snippet was working, I use a string instead of the TV in the snippet call
    [[!date-fr? &tv=`2012-01-27`]] 
    The output was correct «Vendredi 27 janvier 2012»

    Does someone could gently tell me how to write a snippet with a TV as property in a chunk?

    I hope I described my problem correctly, English is not my first language,

    Thank you for answering
    [ed. note: jber last edited this post 14 years, 9 months ago.]
      • 3109 ☆ A M B ☆
      • 894 Posts
      I think you need to prefix your TV in the chunk with tv so instead of:

      
      [[!date-fr? &tv=`[[*eventDate]]`]]
      
      


      it should be:

      
      [[!date-fr? &tv=`[[*tv.eventDate]]`]]
      
      


      and make sure you set &processTVs in your getResources call to 1.

      Let me know if it works.

      Good luck. [ed. note: benmarte last edited this post 14 years, 9 months ago.]
        Benjamin Marte
        Interactive Media Developer
        Follow Me on Twitter | Visit my site | Learn MODX
        • 3749
        • 24,544 Posts
        If it's in a getResources Tpl chunk, it needs to be (I'm sure this is what Ben meant to type):

        [[!date-fr? &tv=`[[+tv.eventDate]]`]]


        Or, you can set &tvPrefix=`` and use this:

        [[!date-fr? &tv=`[[+eventDate]]`]]




          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
          • 13730
          • 149 Posts
          Thanks , Ben and Bob

          [[!date-fr? &tv=`[[+tv.eventDate]]`]]
          is working very fine.

          Thanks again