MODx Community Forums
The MODx Blog
Donations
Feedburner Feeds
Documentation
Bugs & Requests
The Wiki
download MODx
plugins, modules, snippets
online demo
Dec 04, 2008, 01:31 PM
Welcome,
Guest
. Please
login
or
register
.
Did you miss your
activation email?
1 Hour
1 Day
1 Week
1 Month
Forever
Login with username, password and session length
Search via SMF
or Google:
modx forums
all of modxcms.com
web
MODxCMS.com
Forums
Help
Login
Register
News
:Read
Frequently Asked Questions (FAQ)
MODx Community Forums
»
Add-ons, Extensions & Elements
»
Creating & Repurposing Content
»
Ditto
(Moderators:
Mark
,
PaulGregory
)
»
Ditto Filter Question
Pages: [
1
]
Go Down
« Previous topic
Next topic »
Print
Author
Topic: Ditto Filter Question (Read 3271 times)
0 Members and 1 Guest are viewing this topic.
bmcneill
Member
Posts: 64
interactive design and communications
Ditto Filter Question
«
on:
Jul 04, 2007, 12:47 PM »
Can someone help me out here. i am sure i am overlooking something very obvious, but i am trying to do a filter on a TV date field in the ditto call and cannot get it to work right. i want all docs that have an artcle_date (tvarticle_date to ditto) that are greater than now() to appear in this particular section - but continue to get no results. here is the call:
[!Ditto? &display=`all` &tpl=`article_dittoTpl` &dateSource=`tvarticle_date` &dateFormat=`%A %B %d, %Y %r` &filter=`tvarticle_date, UNIX_TIMESTAMP(), 4` &sortBy=`tvarticle_date` &sortDir=`desc` &debug=`1`!]
I have tried the non-UNIX timestamp (CURRENT_TIMESTAMP()) as well and still get no results.
thanks in advance for any help on this.
Logged
rthrash
Foundation
Posts: 9,577
Re: Ditto Filter Question
«
Reply #1 on:
Jul 04, 2007, 12:56 PM »
Is unix_timestamp() or current_timestamp() a PHP function? I can't find a reference to those, and if they are I believe the syntax is @CODE:unix_timestamp(); ... but I'm probably wrong there... Mark?
There is time() available:
http://www.php.net/manual/en/function.time.php
Logged
MODx
is a framework that allows web professionals to turn over sites to end-users for daily maintenance without worrying. Community participation and questions are encouraged, especially when you
help us help you
,
read the wiki
, and review snippet parameters – even if you have to look at the source. Searching the forums helps, too.
Ryan Thrash
MODx Co-Founder
Principal @
Collabpad
work
productively.
work
intelligently.
work
together.
MODx
Current
|
Dev
|
SVN Root
|
JIRA (Bugs)
|
Confluence (097 Wiki)
|
Fisheye SVN Browser
bmcneill
Member
Posts: 64
interactive design and communications
Re: Ditto Filter Question
«
Reply #2 on:
Jul 04, 2007, 02:18 PM »
they are mysql syntax. i was thinking it wanted that for the sql statement. however, i did also try php syntax and could not get date() or time() to work either.
Logged
heliotrope
Coding Team
Posts: 2,447
Re: Ditto Filter Question
«
Reply #3 on:
Jul 04, 2007, 03:40 PM »
Hi,
php functions cannot be used as snippet params.
Create a new snippet with this code for instance
return time();
and then use it within your ditto call.
To embed a snippet inside another one you must use this syntax
[!Ditto? &filter=`tvarticle_date,[[myTimeSnippet]],3` => which means in ditto language Remove all documents from results where tvarticle_date is less than now.
:-)
Logged
Made with MODx :
traduction en ligne
|
agence de traduction
|
copadel, fruits et légumes
|
Provence
|
Dictionnaire en ligne
Professional Website:
dixsix, communication interactive
bmcneill
Member
Posts: 64
interactive design and communications
Re: Ditto Filter Question
«
Reply #4 on:
Jul 04, 2007, 05:03 PM »
ah yeah. thanks for the BGO. it works perfectly now.
thanks all.
Logged
Mark
Moderator
Posts: 3,247
Ditto Developer
Re: Ditto Filter Question
«
Reply #5 on:
Jul 04, 2007, 05:22 PM »
Ditto supports the @EVAL binding to evaluate php expressions in filter clauses. Thus, @EVAL time(); is the correct syntax to get the current unix timestamp ala
http://modxcms.com/eval-binding.html
. Here is a working example which will retrieve all documents in the last year.
Code:
[!Ditto?parents=`2`&debug=`1`&display=`all`&filter=`createdon,@EVAL return strtotime('-1 year');,6`!]
Also, here is a related thread:
http://modxcms.com/forums/index.php/topic,16012.0.html
«
Last Edit: Jul 04, 2007, 05:25 PM by Mark
»
Logged
Documentation
TRAC (Bugtracker)
Forum
How to get help
User Wiki
Credits
SVN Server
Ditto HQ
Stable Download
Development Download
rthrash
Foundation
Posts: 9,577
Re: Ditto Filter Question
«
Reply #6 on:
Jul 05, 2007, 08:17 AM »
Great pointers Mark. Thanks
Logged
MODx
is a framework that allows web professionals to turn over sites to end-users for daily maintenance without worrying. Community participation and questions are encouraged, especially when you
help us help you
,
read the wiki
, and review snippet parameters – even if you have to look at the source. Searching the forums helps, too.
Ryan Thrash
MODx Co-Founder
Principal @
Collabpad
work
productively.
work
intelligently.
work
together.
MODx
Current
|
Dev
|
SVN Root
|
JIRA (Bugs)
|
Confluence (097 Wiki)
|
Fisheye SVN Browser
bmcneill
Member
Posts: 64
interactive design and communications
Re: Ditto Filter Question
«
Reply #7 on:
Jul 05, 2007, 11:49 AM »
on a somewhat related note, if i wanted to add a default date to this TV (so a date is submitted even if the user does not actually select a date), can I use @EVAL return time() as the expression in the Default value of the TV? I am using this right now and it is not writing a value to the database. It may be that '@EVAL return time()' produces a UNIXTIME and I think the TV dates are saved to mysql in non-UNIX time format. do i need to be formatting the 'time()' value to a non-UNIX date format for the default value?
Logged
Mark
Moderator
Posts: 3,247
Ditto Developer
Re: Ditto Filter Question
«
Reply #8 on:
Jul 05, 2007, 12:11 PM »
The default value will be executed when the TV is loaded, not when saved. Thus, the default value would be the current time the tv is loaded.
Logged
Documentation
TRAC (Bugtracker)
Forum
How to get help
User Wiki
Credits
SVN Server
Ditto HQ
Stable Download
Development Download
sal
Member
Posts: 76
Re: Ditto Filter Question
«
Reply #9 on:
Oct 02, 2007, 06:03 AM »
I was wondering on this point actually. I hoped the @EVAL thing would work to set the default date TV value to the current date but realised this probably wouldn't since the field is handled by Tigra so isn't an actual form field. Anyone know a quick way round this?
Logged
FuryDE
Full Member
Posts: 172
Re: Ditto Filter Question
«
Reply #10 on:
Nov 05, 2008, 08:05 AM »
Quote from: Mark on Jul 04, 2007, 05:22 PM
Ditto supports the @EVAL binding to evaluate php expressions in filter clauses. Thus, @EVAL time(); is the correct syntax to get the current unix timestamp ala
http://modxcms.com/eval-binding.html
. Here is a working example which will retrieve all documents in the last year.
Code:
[!Ditto?parents=`2`&debug=`1`&display=`all`&filter=`createdon,@EVAL return strtotime('-1 year');,6`!]
Hi, I wonder if this is correct ... The &filter EXCLUDES documents from the results. So, if you filter documents created on a date greater or equal (6) to "now minus one year", you EXCLUDE all the docs from last year, not include.
Also, I wonder why you first say
@EVAL time();
is correct, but in your example you write
@EVAL return strtotime();
(the difference is the "return").
I ask, because I am having massive problems with date filtering.
I also have a TV with unixtimestamp. Sorting works fine, but filtering doesn't work at all. i have
&filter=`VAStart,@EVAL return time();,3`
to filter out all events from the past. I get all docs. And, if i use 6 instead of 3, I also get all the docs.
Debugging shows me that the filter is recognized corretly and that the values of the VAStart TV are correct too. I don't know what the problem is.
BTW: I used Ditto 2.0.2, but I have just upgraded to 2.1. But I still run into the same problems.
Thanks
Martin
«
Last Edit: Nov 07, 2008, 02:49 AM by FuryDE
»
Logged
Pages: [
1
]
Go Up
Print
« Previous topic
Next topic »
Jump to:
Please select a destination:
-----------------------------
Announcements
-----------------------------
=> Important News
=> Security Notices
-----------------------------
Commercial Support
-----------------------------
=> [CS] About Commercial Support
-----------------------------
Development & Coding
-----------------------------
=> Commercial Inquiries & Bounties
=> Core Code
===> MODx Next
===> xPDO
=> Module, Plugin & Snippet Creation and Modification
=> In Development
=> Templates
=> Internationalization
===> Bulgarian
===> Chinese
===> Czech
===> Dutch
===> French
===> German
===> Irish
===> Italian
===> Japanese
===> Polish
===> Portuguese
===> Russian
===> Slovak
===> Spanish
===> Swedish
===> Persian - فارسي
-----------------------------
Support
-----------------------------
=> Release Support
===> 0.9.6.2
===> 0.9.6.1
===> 0.9.6
===> 0.9.5 and earlier
=> General Support
===> MODx 101
===> E-Commerce, E-Marketing, Analytics & SEO
===> Hosting Experiences
===> IIS / Windows Hosting Issues
=> Documentation, Tips & Tricks
===> Documentation Suggestions & Corrections
-----------------------------
Add-ons, Extensions & Elements
-----------------------------
=> Module, Plugin & Snippet Usage
=> General Repository Items Support
=> Navigation & Tagging/Taxonomy
===> Wayfinder & DropMenu
=> Creating & Repurposing Content
===> Ditto
===> Jot
===> QuickEdit
=> Users, Authentication & Personalization
===> WebloginPE
===> WebLogin, WebSignup and WebChangePwd
=> Rich Text Editors & File Browser
===> TinyMCE
===> FCKeditor
===> MCPuck File Browser
=> Forms, Form Processing & Anti-Spam
===> eForm
=> Search
===> AjaxSearch
=> E-business
=> Polls, Calendars, Address Book and Community
=> Third-party integrations
=> Images, Videos & Podcasts
===> MaxiGallery
=> Manager, Parser & the Core
===> Backup & Versioning
===> Doc Finder
===> ManagerManager
===> PHx
=> Templates
-----------------------------
General Discussions
-----------------------------
=> General MODx Discussions
=> Web Design and Development
=> Wishlist
=> You and Your Sites
=> modxcms.com Discussions and Suggestions
=> Off-topic
-----------------------------
Czech Community
-----------------------------
=> Oznámení
===> Důležitá oznámení/novinky
===> Bezpečnost
=> Podpora
===> FAQ (často kladené otázky)
===> Instalace
===> Moduly, pluginy, "snippets & code" (šablony zdrojových kódů)
===> Design & Šablony
=> Dokumentace, tutoriály (návody) a překlady
===> Dokumentace
===> Tutoriály (návody)
===> Překlady (lokalizace)
=> Komunita
===> Oznámení
===> Představte se, prosím
===> Ukázky práce
===> Různé aneb cokoli co se jinam nehodí
-----------------------------
Bulgarian Community
-----------------------------
=> Поддръжка
===> Често задавани въпроси
===> Инсталация
===> Модули, Плъгини, Снипети и код
===> Дизайн и Шаблони
=> Документация, Ръководства и Превод
===> Документация
===> Ръководства
===> Превод
=> Общество
===> Съобщения
===> Представете се
===> Представете сайта си
===> Дискусии извън MODx
-----------------------------
Dutch Community
-----------------------------
=> Ondersteuning
===> Veel gestelde vragen
===> Modules, Plugins, Snippets & Code
===> Design & Templates
=> Documentatie, Tutorials en Vertalingen
===> Documentatie
===> Tutorials
===> Vertalingen
=> Community
===> Aankondigingen
===> Stel jezelf voor
===> Site Showcase
===> De stamkroeg
-----------------------------
Finnish Community
-----------------------------
=> Tuki
===> UKK
===> Asennus
===> Moduulit, liitännäiset, koodinpätkät
===> Ulkoasu/Sivustopohjat
=> Dokumentaatio, oppaat ja käännökset
===> Dokumentaatio
===> Käännökset
===> Oppaat
=> Yhteisö
===> Tiedotteet
===> Esittele itsesi
===> MODx sivustosi
===> Kahvihuone
-----------------------------
Filipino Community
-----------------------------
=> Suporta
===> Kadalasang tanong
===> Instalasyon
===> Moduler, Maidadagdag, Karagdagang mga Code
===> Desenyo at Templates
=> Dokumentasyon, Mga Turo, Mga Salin
===> Dokumentasyon
===> Mga Turo
===> Mga Salin
=> Kumunidad
===> Anunsyo
===> Ipakilala ang sarili
===> Ang Galing ng pinoy
===> Tsismisan atbp
-----------------------------
French Community
-----------------------------
=> Support
===> FAQ
===> Installation
===> Module, plugin, snippets
===> Design/Templates
=> Documentation, Tutoriels et Traductions
===> Documentation
===> Traduction
===> Tutoriels
=> Communauté
===> Annonces
===> Présentez vous
===> Vos sites
===> Le Bistrot Français
-----------------------------
German Community
-----------------------------
=> Support (de)
===> FAQ (de)
===> Installation (de)
===> Module, Plugins, Snippets & Code (de)
===> Design & Templates (de)
=> Dokumentation, Tutorials und Übersetzung
===> Dokumentation
===> Tutorials (de)
===> Übersetzung
=> Community (de)
===> Ankündigungen
===> Stellt Euch vor
===> Beispielseiten
===> Off Topic / Verschiedenes
-----------------------------
Irish Community
-----------------------------
=> Tacaíocht
===> CC Ceisteanna Coitianta
===> Breiseáin (cláir bhreise), Snippets & Comhaid
===> Suiteáil
===> Dearadh & Teimpléid
=> Doiciméid, Teagascóireacht agus Aistriúchán
===> Doiciméadú
===> Teagascóireacht
===> Aistriúchán
=> Pobal
===> Fógraí
===> Cuir Tú Féin in Aithne
===> Gailearaí an Láithreáin
===> Caifé / An Tábhairne / Ábhar Cainte Eile / Ilghnéitheach
-----------------------------
Italian Community
-----------------------------
=> Supporto
===> FAQ
===> Installazione
===> Moduli, Plugin, Snippet e altro codice
===> Web Design e Template
=> Documentazione, Tutorial e Traduzione
===> Documentazione
===> Tutorial
===> Traduzione
=> Comunità
===> Annunci
===> Presentazioni
===> Siti in vetrina
===> Chiacchiere in libertà
-----------------------------
Japanese Community
-----------------------------
=> サポート
===> 良くある質問
===> インストール
===> モジュール・プラグイン・スニペット・本体
===> デザインやテンプレート
=> マニュアル・テュートリアル・翻訳
===> マニュアル
===> 事例集、テュートリアル
===> 日本語化
=> コミュニティ
===> お知らせ
===> MODxサイト展示場
===> 自己紹介
===> 雑談
===> 国産リソース
-----------------------------
Persian Community
-----------------------------
=> پشتيباني
===> راهنما
===> نصب
===> ماژول , پلاگین ها , کد ها و جزییات
===> طراحی و قالب ها
=> مستند سازی , آموزش ها و ترجمه ها
===> مستند سازی
===> آموزش ها
===> ترجمه ها
=> انجمن ها
===> اخبار
===> معرفی کردن خود
===> نمایش دادن سایت ها
===> بحث های عمومی و سایر موضوعات
-----------------------------
Polish Community
-----------------------------
=> Wsparcie
===> FAQ
===> Instalacja
===> Moduły, pluginy, snipety i kod
===> Wygląd i szablony
=> Dokumentacja, tutoriale i tłumaczenie
===> Dokumentacja
===> Tutoriale
===> Tłumaczenie
=> Społeczność
===> Ogłoszenia
===> Przedstaw się
===> Twój serwis WWW
===> Hyde Park
-----------------------------
Portuguese Community
-----------------------------
=> Suporte
===> FAQ - Dúvidas Frequentes
===> Instalação
===> Módulos, Plugins, Snippets e Código
===> Design e Templates
=> Documentação, Guias e Traduções
===> Documentação
===> Guias
===> Traduções
=> Comunidade
===> Anúncios
===> Apresente-se!
===> Bar da esquina (fora de tópico)
===> Portfólio de Sites
-----------------------------
Russian Community
-----------------------------
=> Поддержка
===> ЧАВО (FAQ)
===> Установка
===> Модули, плагины, сниппеты и код
===> Дизайны и шаблоны
=> Документация, Уроки, Перевод
===> Документация
===> Уроки
===> Перевод
=> Сообщество
===> Объявления
===> Представьтесь публике
===> Галерея сайтов
===> Диван
-----------------------------
Scandinavian Community
-----------------------------
=> Support
===> Frågor och svar
===> Installation
===> Moduler, plugins, snippets och kod
===> Design & sidmallar
=> Dokumentation, guider och översättningar
===> Dokumentation
===> Guider
===> Översättningar
=> Webbgemenskap
===> Meddelanden
===> Presentera dig själv
===> Visa upp dina webbsidor
===> Ordet fritt
-----------------------------
Spanish Community
-----------------------------
=> Soporte
===> FAQ
===> Instalación
===> Modulos, Plugins, Snippets & Código
===> Diseño y plantillas
=> Documentación, Tutoriales y Traducciones
===> Documentatción
===> Tutoriales
===> Traducciones
=> Comunidad
===> Anuncios
===> Presentaciones personales
===> Muestra de sitios
===> El Café
-----------------------------
TÜRKÇE (Turkish)
-----------------------------
=> Destek
===> SSS
===> Kurulum
===> Modüller, Pluginler, Snippetlar & Kodlar
===> Dizayn & Temalar
=> Belgeleme, Eğitmenler ve Çeviri
===> Belgeleme
===> Eğitmenler
===> Çeviri
=> Topluluk
===> Duyurular
===> Kendinizi Tanıtın
===> Site Vitrini
===> Konu Dışı