How to display news (events) on modx revo depending on the date in one or another block? 
The content manager indicates the date, and on the basis of this event appears in a particular block.
The question does not indicate how the date is set. If it is specified in publishedon , then you can select news for each of the blocks using the getResourses snippet, comparing the date of the news with the current date.
For example, for the first block (New), a call to the snippet may be such (for example, news is descendants of a resource with ID == 10):
[[getResources? &parents=`10` &tpl=`news-block-item` &includeContent=`1` &where=`{"publishedon:>":[[!now]]}` &limit=`4` ]] Please note that publishedon is stored as UNIX-time and the comparison should also be made with the same timestamp value. Snippet now can be something like
<?php return date("U"); If the news date is set in TV (in the example below - newsdate), then the condition will be different. For example:
[[getResources? &parents=`10` &tpl=`news-block-item` &includeContent=`1` &tvFilters=`newsdate>>[[!now]]}` &limit=`4` ]] [[getResources? &parents= [[getResources? &parents= 8` & tpl = ImmediateEvent & includeContent = 1 & includeTVs = 1 & processTVs = 1 & where = {"publishedon:>":[[!toDate]]} & limit = 4444 ]] `I’m putting all the news out - Vyacheslav Yashnikovpublishedon is stored in the database and compared as a timestamp , and displayed in formatted form. Therefore, this parameter should be compared in numerical form. I fixed the snippet now in the answer. - tutankhamunSource: https://ru.stackoverflow.com/questions/559880/
All Articles