I`m trying to find working solution for event pages by getresources. In EVO I`ve made it by Ditto.
Is here anywhere a working solution or good detailed tutorial where are all TV setups and of course working getresources call?
Call should only show pages that are published and have event time set up. Sorting and showing by time of event-date TV.
No need to show past events (Event ending set up by unpublish time).
Tassu, webmaster of Valokammi
-
☆ A M B ☆
- 756 Posts
have you looked at Articles by splittingred
http://modx.com/extras/package/articles
Evo Revo // Ubuntu, CentOS, Win // Apache 2x, Lighttp (Lighty)
Visit
CharlesMx.com for latest news and status updates.
I know Articles, but it not help for this situation. I`ve done blog etc. in this site old way. I`ve tried some calls, but none of them works ok.
getresources call:
[[!getResources?
&parents=`0`
&tpl=`eventListing`
&includeTVs=`1`
&processTVs=`1`
&sortbyTV=`tv.date`
&sortdirTV=`ASC`
&sortbyTVType=`string`
&limit=`1`
]]
TPL Chunk:
<div class="eventListing"><p>[[+tv.date:date=`%d.%m.%Y`]]</p><a href="[[~[[+id]]]]">[[+pagetitle]]</a></div>
Strange thing is that when I activate TV for templates. It produces 1.1.1970 date for blank fields all pages who uses template.
TV settings:
Input type: date
Allow blank: Yes
Output type: Date
Date Format: %A %d, %B %Y
If no value, use current date: no
So whats going on?
Tassu, webmaster of Valokammi
use default output-type and:
<div class="eventListing"><p>[[+tv.date:strtotime:date=`%d.%m.%Y`]]</p><a href="[[~[[+id]]]]">[[+pagetitle]]</a></div>
and do:
I think main problem seems to be that when I assing TV to template and go to page where TV affects. There`s no empty date field on a page. It has date 1.1.1970 2:00 am already. And thats in all pages that have TV access. Now call is showing all pages which uses template.
I tried to empty date field, but after saving its still there with 1.1.1970 2:00 AM.
And I think what Bruno tell, needs &tvPrefix=`` into call.
I tried Bruno`s date format, it don`t render date into pages.
Update Found mistake that I`ve made in TV. No more 1.1.1970 in date fields.
[ed. note: valokammi last edited this post 14 years, 8 months ago.]
Tassu, webmaster of Valokammi
Ok I`ve tested a lot of tryouts but no good

And I know solution is clear and simple. But I can`t make this work.
My latest call (Some finnish in calls, don`t affect the real issue):
<div class="tapahtumat">
<h3>Tapahtumat</h3>
[[!getResources:default=`Ei tapahtumia tällä hetkellä!`?
&parents=`0`
&tpl=`eventListing`
&tvPrefix=``
&includeTVs=`1`
&processTVs=`1`
&sortbyTV=`start-date`
&sortdirTV=`ASC`
]]
</div>
Tpl:
<div class="eventListing"><p>[[+tv.start-date:strtotime:date=`%d.%m.%Y`]]</p><a href="[[~[[+id]]]]">[[+pagetitle]]</a></div>
TV name: start-date
Deleted cache from server. Check the database. Cleared cache etc. I deleted old TV:s and make new one.
Now listing links even if datefields are empty. No pages have a startdate. So call should render default text. No date rendered.
Tassu, webmaster of Valokammi
-
☆ A M B ☆
- 756 Posts
That is because that is the base start point from which all php time functions are based on, you'd have to set the default date. I also think that you do not need the stringtotime call as it is a time format already.
[[+tv.date:date=`%d.%m.%Y`]]
Also in your snippet call you should set the 'sortbyTVType' as "datetime".
Cheers
Evo Revo // Ubuntu, CentOS, Win // Apache 2x, Lighttp (Lighty)
Visit
CharlesMx.com for latest news and status updates.
Still not working. Listing all pages.
Call:
<div class="tapahtumat">
<h3>Tapahtumat</h3>
[[!getResources:default=`Ei tapahtumia tällä hetkellä!`?
&parents=`0`
&tpl=`eventListing`
&includeTVs=`1`
&processTVs=`1`
&tvPrefix=``
&sortbyTV=`start-date`
&sortdirTV=`ASC`
&sortbyTVType=`datetime`
]]
</div>
TPL:
<div class="eventListing"><p>[[+tv.start-date:date=`%d.%m.%Y`]]</p><a href="[[~[[+id]]]]">[[+pagetitle]]</a></div>
Tassu, webmaster of Valokammi
Well, they are blank fields now. I had wrong set up in TV. How about then call and TPL?
Tassu, webmaster of Valokammi