MODx Community Forums
The MODx Blog
Donations
Feedburner Feeds
Documentation
Bugs & Requests
The Wiki
download MODx
plugins, modules, snippets
online demo
Sep 07, 2008, 01:28 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
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
)
»
Filtering by publish year
Pages: [
1
]
Go Down
« Previous topic
Next topic »
Print
Author
Topic: Filtering by publish year (Read 2189 times)
0 Members and 1 Guest are viewing this topic.
neilcreek
Full Member
Posts: 130
Filtering by publish year
«
on:
Apr 26, 2007, 10:46 PM »
Hi, I hope this hasn't been answered elsewhere, but I've scoured the documentation, wikis, forums etc and haven't been able to find an answer which I am able to apply to my problem.
I am building a site which will have an archive of articles which have a specific date (I've entered the date into the pub_date field). I am using ditto to present the articles and I need to be able to display a selected number of results by year. I have a box on my page with ALL of 2007 articles, and two other boxes which show the first 5 articles each of 2006 and 2005. I've looked at the $filter parameter, but can't figure out how to get it to filter out all years by one in the pub_date field. What am I missing?
Thanks so much for your help!
Logged
Mark
Moderator
Posts: 3,247
Ditto Developer
Re: Filtering by publish year
«
Reply #1 on:
Apr 27, 2007, 12:28 AM »
Take a look at the dateFilter extender (and its example use in 0.9.6 in conjunction with Reflect)
Logged
Documentation
TRAC (Bugtracker)
Forum
How to get help
User Wiki
Credits
SVN Server
Ditto HQ
Stable Download
Development Download
neilcreek
Full Member
Posts: 130
Re: Filtering by publish year
«
Reply #2 on:
Apr 27, 2007, 02:12 AM »
Thanks for your reply, but I'm afraid I need a bit more hand-holding than that. I've searched and my frustration is growing, so I'm going to have to swallow my pride and ask for more help. The biggest problem I'm having is finding a "top level" explanation of how it all works and what I need to do, perhaps with examples. In my searching I found:
This thread, which seems close to explaining, but confuses me because I'm not using wordpress, and I don't understand how this links with the ditto snippet use, because from my reading it seems that both need to be used?
http://modxcms.com/forums/index.php/topic,14003.0.html
The official documentation has no examples and doesn't explain how to correctly code the snippet, only listing the parameters, and I'm afraid describing them in computer programmer terms, which I find hard to figure out, not being very familiar with programming:
http://ditto.modxcms.com/files/snippet-reflect-php.html
The TRAC doesn't seem to make any mention of reflect at all:
http://modxcms.com/ditto_trac.html
The compiled documentation for Ditto has been a fantastic resource, but only makes mention of reflect in passing:
http://modxcms.com/forums/index.php/topic,13533.0.html
I tried the MODx wiki, but that doesn't seem to have anything about reflect:
http://wiki.modxcms.com/index.php/Ditto
I really have tried to do the research but having as little knowledge of php as I do, I feel like I'm lost in the woods. A simple tutorial would be a huge help, and I'm ahppy to figure it out myself, but I feel like I've jumped in the deep end before I can swim!!
Sorry for being so helpless, I really appreciate the time you take to help me out.
Logged
Mark
Moderator
Posts: 3,247
Ditto Developer
Re: Filtering by publish year
«
Reply #3 on:
Apr 27, 2007, 02:25 AM »
Your are not helpless at all. You've perfectly followed the policy on
how to get help
.
The documentation deficiencies are being addressed with a MODx based support site to be unveiled in the near future. If you'd like a sneak peek PM me.
This should get your started:
1. Add &extenders=`dateFilter` &dateSource=`pub_date` to your uncached ( [! syntax ) Ditto 2 call
2. Append &year=YEAR to your URL or send via POST
Ditto will do the rest
Logged
Documentation
TRAC (Bugtracker)
Forum
How to get help
User Wiki
Credits
SVN Server
Ditto HQ
Stable Download
Development Download
neilcreek
Full Member
Posts: 130
Re: Filtering by publish year
«
Reply #4 on:
Apr 28, 2007, 10:57 PM »
Thanks for your ongoing help!
I've added &extenders=`dateFilter` to the ditto call. I already was using the correct &dateSource. I don't follow what you mean by "uncached ( [! syntax )". I'm also not sure what you meant in point 2. My ditto call is embedded within a page, and that page will have three different ditto calls, showing documents from 3 different years, so the filter will need to be different on the same page. That, I assume, would mean that putting the &year parameter in the url wouldn't work. I'm not sure how I can put a "POST" into the ditto call?
This is the (first) ditto call on my page as it is now:
Code:
[[Ditto? &tpl=`dittospeeches` &parents=`17` &dateSource=`pub_date` &dateFormat=`%d %b %g` &sortBy=`pub_date` &display=`999` &extenders=`dateFilter`]]
This is the page as it looks now:
http://www.orionvisuals.com/wip/harryjenkins/index.php?id=4
This is a screencap from the designer I'm working with showing how he wants this page to look (some aspects of the design have changed since this stage but the layout is the same):
Logged
Mark
Moderator
Posts: 3,247
Ditto Developer
Re: Filtering by publish year
«
Reply #5 on:
Apr 29, 2007, 01:20 PM »
For uncached syntax I mean calling Ditto like so: [!Ditto!] instead of [[Ditto]].
To handle the multiple Ditto calls on the same page add &id=`UNIQUE STRING` to each Ditto call where UNIQUE STRING is unique for each call.
Lastly, add &UNIQUE STRING_year=`2006` where UNIQUE STRING is the same as above for the corresponding Ditto call you want to affect and 2006 is the year you want to show.
If you want to be able to do this without adding things to the URL file a feature request using TRAC (link in my signerature).
Logged
Documentation
TRAC (Bugtracker)
Forum
How to get help
User Wiki
Credits
SVN Server
Ditto HQ
Stable Download
Development Download
neilcreek
Full Member
Posts: 130
Re: Filtering by publish year
«
Reply #6 on:
Apr 29, 2007, 10:00 PM »
Okay, I've given that a try, here's what my Ditto call looks like now:
Code:
[!Ditto? &tpl=`dittospeeches` &parents=`17` &dateSource=`pub_date` &dateFormat=`%d %b %g` &sortBy=`pub_date` &display=`999` &extenders=`dateFilter` &id=`speeches2007` &speeches2007_year=`2007` !]
Unfortunately, it hasn't filtered out items older than 2007:
http://www.orionvisuals.com/wip/harryjenkins/index.php?id=4
My first guess is that &speeches2007_year=`2007` is looking to the creation date for the year, when i want it to look to the pub_date. All of the items will be created in 2007, so fot items that were originally created in past years, i've set their date in the pub_date field. Is there any way to get &speeches2007_year=`2007` to look in pub_date?
Logged
Mark
Moderator
Posts: 3,247
Ditto Developer
Re: Filtering by publish year
«
Reply #7 on:
Apr 29, 2007, 11:30 PM »
You need to add &speeches2007_year=2007 to the URL, not the Ditto call. If you do, it works on that page.
Quote from: Mark on Apr 29, 2007, 01:20 PM
If you want to be able to do this without adding things to the URL file a feature request using TRAC (link in my signerature).
Logged
Documentation
TRAC (Bugtracker)
Forum
How to get help
User Wiki
Credits
SVN Server
Ditto HQ
Stable Download
Development Download
roki13
Member
Posts: 74
Re: Filtering by publish year
«
Reply #8 on:
May 06, 2007, 03:29 AM »
Hi,
I have the same problem. My call is the following:
Code:
[!Ditto? &tpl=`ListNews` &parents=`58` &dateSource=`NewsDate` &dateFormat=`%d/%m/%Y` &sortBy=`NewsDate` &display=`999` &extenders=`dateFilter` &id=`allnews` !]
my tv is called NewsDate
I tried to put &NewsDate=2006 in the url, didn't filter. I tried &NewDate_year=2006, not working neither. Any idea ?
thanks,
Seb
Logged
Mark
Moderator
Posts: 3,247
Ditto Developer
Re: Filtering by publish year
«
Reply #9 on:
May 06, 2007, 03:11 PM »
@roki13: The URL format is id_year=2006 where ID is what you have set &id to.
@all: The development version should now allow you to do this via parameters. For example:
Code:
[!Ditto? &parents=`2` &extenders=`dateFilter` &dateSource=`createdon` &year=`2006`!]
You can get the development version
here
Logged
Documentation
TRAC (Bugtracker)
Forum
How to get help
User Wiki
Credits
SVN Server
Ditto HQ
Stable Download
Development Download
roki13
Member
Posts: 74
Re: Filtering by publish year
«
Reply #10 on:
May 08, 2007, 04:29 AM »
ok got it
On the same subject, I want to create a drop down list that will contain the years of my news. And be able to switch from one year to another (my news are not filtered by month). Is there a way of doing that ? I tried using tplContainer and tplYear. I put the following in tplContainer :
Code:
<select name="allnews_year" onchange="changeNewsYear();">
[+archive_items+]
</select>
and in tplYear:
Code:
<option value="[+year+]">[+year+]</option>
which gives the following output:
Code:
<select name="allnews_year" onchange="changeNewsYear();">
<ul class="reflect_archive"><li class="reflect_year"><option value="2007">2007</option>
<ul><li class="reflect_month"><a href="/fkm/index.php?id=67&reflect_10_month=4&reflect_10_year=2007&reflect_10_day=false&reflect_10_start=0" title="April 2007" class="reflect_month_link">April</a>
<ul class="reflect_items">
<li class="reflect_item"><a href="index.php?id=66" title="news 1" class="reflect_item_link">news 1</a> (<span class="reflect_date">24-Apr-07 13:19</span>)</li><li class="reflect_item"><a href="index.php?id=65" title="news 2" class="reflect_item_link">news 2</a> (<span class="reflect_date">24-Apr-07 13:17</span>)</li><li class="reflect_item"><a href="index.php?id=64" title="Back home" class="reflect_item_link">Back home</a> (<span class="reflect_date">24-Apr-07 12:07</span>)</li></ul></li></ul><ul><li class="reflect_month"><a href="/fkm/index.php?id=67&reflect_10_month=5&reflect_10_year=2007&reflect_10_day=false&reflect_10_start=0" title="May 2007" class="reflect_month_link">May</a>
<ul class="reflect_items">
<li class="reflect_item"><a href="index.php?id=74" title="another news in may" class="reflect_item_link">another news in may</a> (<span class="reflect_date">05-May-07 19:55</span>)</li></ul></li></ul></li></ul>
</select>
The output of tplContainer is correct, but obviously the tplYear is not. Is there any way to get rid of the <ul> and <li> tags, and to avoid months getting displayed as well ? I guess I'm gonna need to hack the snippet but want to make sure first.
thanks a million
seb
Logged
Mark
Moderator
Posts: 3,247
Ditto Developer
Re: Filtering by publish year
«
Reply #11 on:
May 08, 2007, 09:39 AM »
Yes there is in the current dev version. Its output is 100% templateable. You can get a copy from the link in my signerature.
Logged
Documentation
TRAC (Bugtracker)
Forum
How to get help
User Wiki
Credits
SVN Server
Ditto HQ
Stable Download
Development Download
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.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 (and 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
=> Images, Videos & Podcasts
===> MaxiGallery
=> Manager, Parser & the Core
===> PHx
=> Templates
-----------------------------
General Discussions
-----------------------------
=> General MODx Discussions
=> Web Design and Development
=> Wishlist
=> You and Your Sites
=> modxcms.com Discussions and Suggestions
=> Off-topic
-----------------------------
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ışı