【问题标题】:TYPO3 viewhelper date in conditionTYPO3 viewhelper 日期条件
【发布时间】:2015-04-13 19:01:16
【问题描述】:

我想在 Typo3 6.2 的扩展中比较两个日期的条件与流体。这是我现在尝试过的:

<f:if condition="{f:format.date(format : 'U', date : {orderdate})}
>= {f:format.date(format : 'U', date : {v:system.dateTime()})}">
  <f:then>
    do it
  </f:then>
  <f:else>
    do it not
  </f:else>
</f:if>

来自 vhs 扩展的 viewhelper {v:system.dateTime()} 返回时间戳。但是此代码仅返回“then”语句中的条件。条件不以这种方式工作......

我的问题是,如何比较流体中的两个日期?有人知道解决办法吗?

【问题讨论】:

  • 1) ordinate 的类型是什么? 2)v:system.dateTime() 的类型(和值)是什么,3)您对条件的期望是什么? 4)创建自定义 VH 很容易,如果您先回答 3 点,我会尽力帮助您,但请用示例描述它
  • 感谢您的回复。当我以内联样式编写条件时,语句就起作用了!在问题中查看我的新代码。
  • 然后写一个答案并接受它为有效

标签: format conditional-statements fluid typo3-6.2.x viewhelper


【解决方案1】:

我找到了这个解决方案:代码功能,当我以更好的内联样式编写条件时:

<f:if condition="{kurse.anmeldedate -> f:format.date(format : 'U')} >
{v:system.dateTime() -> f:format.date(format : 'U')}">
   <f:then>
      do it
   </f:then>
   <f:else>
     do it not
   </f:else>
</f:if>

Viewhelper v:system.dateTime() 以时间戳的形式给出现在的时间,并且是来自扩展 VHS:Fluid ViewHelpers 的 VH。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2017-01-26
    • 1970-01-01
    • 2012-01-04
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2021-11-10
    • 1970-01-01
    相关资源
    最近更新 更多