We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 42261
    • 3 Posts
    Hello!

    I'm having this problem with a template variable and I can't seem to figure out what's wrong. The TV is called 'datetime' and the input & output types are both set to 'date'. When I call the TV on the page, it displays nothing. It's not working with [[*datetime]]. Nor with getResources.

    getResources line: [[!getResources? &parents=`[[*id]]` &tpl=`eventlisting` &includeTVs=`1` &processTVs=`1` &includeContent=`1` &debug=`1`]]

    the chunk:
    <p>[[+tv.datetime]]</p>
    <p>[[+tv.venue]]</p>
    <p>[[+tv.website]]</p> - tv.website is a URL and it's being displayed so I'm pretty sure processTVs is working

    the error log:
    [2012-12-09 01:37:19] (ERROR @ /modx/index.php) context for 3 is web
    [2012-12-09 01:37:19] (ERROR @ /modx/index.php) SELECT `modResource`.`id`, `modResource`.`type`, `modResource`.`contentType`, `modResource`.`pagetitle`, `modResource`.`longtitle`, `modResource`.`description`, `modResource`.`alias`, `modResource`.`link_attributes`, `modResource`.`published`, `modResource`.`pub_date`, `modResource`.`unpub_date`, `modResource`.`parent`, `modResource`.`isfolder`, `modResource`.`introtext`, `modResource`.`content`, `modResource`.`richtext`, `modResource`.`template`, `modResource`.`menuindex`, `modResource`.`searchable`, `modResource`.`cacheable`, `modResource`.`createdby`, `modResource`.`createdon`, `modResource`.`editedby`, `modResource`.`editedon`, `modResource`.`deleted`, `modResource`.`deletedon`, `modResource`.`deletedby`, `modResource`.`publishedon`, `modResource`.`publishedby`, `modResource`.`menutitle`, `modResource`.`donthit`, `modResource`.`privateweb`, `modResource`.`privatemgr`, `modResource`.`content_dispo`, `modResource`.`hidemenu`, `modResource`.`class_key`, `modResource`.`context_key`, `modResource`.`content_type`, `modResource`.`uri`, `modResource`.`uri_override`, `modResource`.`hide_children_in_tree`, `modResource`.`show_in_tree`, `modResource`.`properties` FROM `modx_site_content` AS `modResource` WHERE ( modResource.parent IN (3,2) AND `modResource`.`deleted` = 0 AND `modResource`.`published` = 1 ) ORDER BY publishedon DESC LIMIT 5

    If I set the TV's output type to default (or even URL!) it will be displayed. But I'd like to be able to change the date format.
    Setting it to default and calling tv.datetime:date=`%a %b %e, %Y` isn't working either

    Am I missing something? Thank you in advance for you help smiley

    This question has been answered by doulfe. See the first response.

    • I presume the TV is available for editing - you have assigned it to the correct templates. Are you using any kind of permission controls?

      Input Options -
      Input Type: Date

      Output Options -
      Output Type: Date
      Date Format: %a %b %e, %Y
      If no value, use current date: Yes

      [[*datetime]] shows Wed Dec 12, 2012

        Studying MODX in the desert - http://sottwell.com
        Tips and Tricks from the MODX Forums and Slack Channels - http://modxcookbook.com
        Join the Slack Community - http://modx.org
      • discuss.answer
        • 42261
        • 3 Posts
        Yes, it's been assigned to the correct templates and I'm not using permissions.

        Anyway, after uninstalling and reinstalling for about 3 times, it eventually worked smiley Not sure what happened but I'm glad it works.

        Thanks for your reply