I want to compare the getResources's results to filter them by date.
It does not return anything.
What am I missing?
[[!getResources?
&parents=`[[*parent]]`
&tplPath=`[[++core_path]]path/to/getresources/`
&tpl=`@FILE subnavigation.tpl`
&limit=``
&sortby=`createdon`
&includeTVs=`1`
&tvFilters=`eventEnd:strtotime=<[[!today:strtotime]]`
&toPlaceholder=`resultRow`
]]
today snippet is
<?php
$scriptProperties['format'] = $modx->getOption('format', $scriptProperties, "Y-m-d h:i:s");
return date($scriptProperties['format']);
eventEnd is a date TV, with the default output.
Rico
Genius is one percent inspiration and ninety-nine percent perspiration.
Thomas A. Edison
MODx is great, but knowing how to use it well makes it perfect!
www.virtudraft.com
Security, security, security! |
Indonesian MODx Forum |
MODx Revo's cheatsheets |
MODx Evo's cheatsheets
Author of
Easy 2 Gallery 1.4.x,
PHPTidy,
spieFeed,
FileDownload R,
Upload To Users CMP,
Inherit Template TV,
LexRating,
ExerPlan,
Lingua,
virtuNewsletter,
Grid Class Key,
SmartTag,
prevNext
Maintainter/contributor of
Babel
Because it's hard to follow all topics on the forum, PING ME ON TWITTER
@_goldsky if you need my help.
-
- 793 Posts
1.-- Besides of &includeTVs=`1` you may need &processTVs=`1` too.
2.-- Shouldn't it be &limit=`0` ?
3.-- Perhaps the snippet call in the &tvFilters cannot be parsed correctly.
Is there any chance that you'd add this number (int/float) comparisons?
Only for number types.
This will be very useful when we need this, eg: we can add eventStart & eventEnd tvs to some event/class schedule/competition deadline resources, so getResources can return only the next available events.
....... please
Rico
Genius is one percent inspiration and ninety-nine percent perspiration.
Thomas A. Edison
MODx is great, but knowing how to use it well makes it perfect!
www.virtudraft.com
Security, security, security! |
Indonesian MODx Forum |
MODx Revo's cheatsheets |
MODx Evo's cheatsheets
Author of
Easy 2 Gallery 1.4.x,
PHPTidy,
spieFeed,
FileDownload R,
Upload To Users CMP,
Inherit Template TV,
LexRating,
ExerPlan,
Lingua,
virtuNewsletter,
Grid Class Key,
SmartTag,
prevNext
Maintainter/contributor of
Babel
Because it's hard to follow all topics on the forum, PING ME ON TWITTER
@_goldsky if you need my help.
-
- 57 Posts
I need exactly the same feature. I tried filtering with &where, but it didn't seem to work with TVs:
&where=`{"event-date":>=":"[[!currentTimestamp]]"}`
christian seel - www.christianseel.com
web developer & designer at chsmedien.de
twitter: @christianseel / @chsmedien
The where clause does not work with Template Variables at this time.
-
- 57 Posts
Thanks for your reply Jason.
Is there any other way? Or is there a new feature planed to get this working?
christian seel - www.christianseel.com
web developer & designer at chsmedien.de
twitter: @christianseel / @chsmedien
It could be added as a feature, but everyone needs to realize that the Template Variable values are all stored as strings and cannot be optimized for queries like this. It will always be better to use a custom model for storing data that is not actually a web page, like Calendar Events or Products in an inventory. You can optimize searches and sorting to your specific needs that way.
That said, I will try to add this feature in the near future to the tvFilters property, but it's not trivial and will likely not be useful (due to performance) for large sets of data.
Hi
in template @FILE subnavigation.tpl it's possible to insert IF and pass to it's operand & then date in timestamp format. I believe it's possible to compare current timestamp with the timestamp from tv in IF snippet
modx and ecommerce pro
@modx.customize,
That way makes modx creates query twice.
I think that'd slow down the performance.
Rico
Genius is one percent inspiration and ninety-nine percent perspiration.
Thomas A. Edison
MODx is great, but knowing how to use it well makes it perfect!
www.virtudraft.com
Security, security, security! |
Indonesian MODx Forum |
MODx Revo's cheatsheets |
MODx Evo's cheatsheets
Author of
Easy 2 Gallery 1.4.x,
PHPTidy,
spieFeed,
FileDownload R,
Upload To Users CMP,
Inherit Template TV,
LexRating,
ExerPlan,
Lingua,
virtuNewsletter,
Grid Class Key,
SmartTag,
prevNext
Maintainter/contributor of
Babel
Because it's hard to follow all topics on the forum, PING ME ON TWITTER
@_goldsky if you need my help.