Dec 04, 2008, 03:53 PM *
Welcome, Guest. Please login or register.
Did you miss your activation email?

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  
Pages: [1] 2   Go Down
  Print  
Author Topic: Sort by a date TV  (Read 3349 times)
0 Members and 1 Guest are viewing this topic.
bigSlim
Jr. Member
*
Posts: 32


« on: Aug 08, 2007, 03:50 AM »

Hi

I am currently using the listIndexer snippet to display a list of Events. Currently they are being ordered by creation date. I know I can change this ''createdon' date order to 'editedon' date OR change the order to 'alpha' or 'menuindex'

BUT

What I'd like to order it by is the event start date. I have created a TV called EventStartDate for each Event.

Can someone tell me how I can order my Events by this TV please?

Thanks in advance

bS
Logged
Mark
Moderator
*
Posts: 3,247


Ditto Developer


WWW
« Reply #1 on: Aug 08, 2007, 10:46 AM »

You can do this with Ditto. There is a tutorial available here: http://ditto.modxcms.com/tutorials/sort-by-a-date-tv.html
Logged

bigSlim
Jr. Member
*
Posts: 32


« Reply #2 on: Aug 08, 2007, 02:54 PM »

Hi

Thanks for the reply but im still not sure how to execute this? Do i no longer need to use ListIndexer?

If so, how do I then use Ditto to call all sub documents from the parent document? And then what do I do to order by mt date TV?

Sorry for my lack of knowledge

Regards

bS
Logged
Mark
Moderator
*
Posts: 3,247


Ditto Developer


WWW
« Reply #3 on: Aug 08, 2007, 03:49 PM »

You would use Ditto to execute this. To get all sub documents (assuming you have at least Ditto 2.0.2) just append &depth=`0`. As for the date sorting, follow the tutorial in my previous post.
Logged

bigSlim
Jr. Member
*
Posts: 32


« Reply #4 on: Aug 09, 2007, 03:05 AM »

I still can't seem to get this working. If I can explain my situation:

I have a document (id=54) executing a Ditto call [[Ditto? &parent=`71` &depth=`0` $display=`5` &sortBy=`EventStartDate` &dateSource=`EventStartDate`]]

I have a container (id=71) containing 5 documents (events)

All Im getting is list of 5 documents but not ones specific to that parent id?

Can you help me further please

Thanks

bS

Logged
Mark
Moderator
*
Posts: 3,247


Ditto Developer


WWW
« Reply #5 on: Aug 09, 2007, 03:18 AM »

&parents (note the s)
Logged

bigSlim
Jr. Member
*
Posts: 32


« Reply #6 on: Aug 09, 2007, 07:41 AM »

Oh dear! Thanks...

So how do I format the unixtime field when not using the ditto snippet? (Since I had to change the TV to UNIXTIME instead of the original Date Formatter)

Its fine when in the events list page as I can format with the ditto snippet but when in the actual event page, since im calling is [*EventStartDate*] im getting it as a unixtime format??

how can this be formatted?

Thanks again

bS
Logged
Mark
Moderator
*
Posts: 3,247


Ditto Developer


WWW
« Reply #7 on: Aug 09, 2007, 10:12 PM »

You can either use the DateFormat snippet or PHx.
Logged

bigSlim
Jr. Member
*
Posts: 32


« Reply #8 on: Aug 10, 2007, 11:50 AM »

Hmmm? Came across another issue....

When I used the ListIndexer snippet, I could modify the following code and insert a TV value EventType and call it

----------------

$EventTypeClass=$tvEventType['EventType'];

// Link to page
$output .= '<td class="'.$EventTypeClass.'">'.$EventTypeClass.'<br /><a href="[~'.$recentRecord['id'].'~]" title="'.strip_tags($recentRecord['pagetitle']).'">'.$recentRecord['pagetitle'].'</a></td>';

-----------------

How can I add this into the english.inc.php file? (Im presuming this is where you can change the outputted code)
Currently I have:

----------------

<tr><td class="eventdate">[+date+]</td><td><a href="[~[+id+]~]">[+pagetitle+]</a></td></tr>

----------------

I've tried adding in code as in the 1st example but it doesn't like it....

Thanks again

bS
Logged
Mark
Moderator
*
Posts: 3,247


Ditto Developer


WWW
« Reply #9 on: Aug 10, 2007, 06:27 PM »

Follow this tutorial for custom templating: http://ditto.modxcms.com/tutorials/creating-a-custom-template.html
Logged

fruitwerks
Sr. Member
****
Posts: 333


I have 70 birds, I deal with enough sh.. :)


« Reply #10 on: Feb 28, 2008, 11:27 AM »

... I am trying to use the link mentioned earlier to show a human readable date, but all I get is the unix date... Did I miss something?

Thanks
Logged
Mark
Moderator
*
Posts: 3,247


Ditto Developer


WWW
« Reply #11 on: Feb 28, 2008, 09:34 PM »

Can you provide the debug output of your call?
Logged

fruitwerks
Sr. Member
****
Posts: 333


I have 70 birds, I deal with enough sh.. :)


« Reply #12 on: Feb 28, 2008, 10:32 PM »

debug enabled... http://sweetskies.fruitwerks.us/non_menu_items/nestbox_news.php

I think I tried this before, but I added separate month day and year tv's Smiley
Logged
tkfm
Committed to MODx
*****
Posts: 624


WWW
« Reply #13 on: Feb 28, 2008, 11:13 PM »

I think you should use [+date+] instead of [+nbn_date+] in your Ditto
template chunk.
Code:
<hr/>
<h3>[+title+]</h3>
<p>[+introtext+]</p>
<p>[+date+]</p>
Logged
fruitwerks
Sr. Member
****
Posts: 333


I have 70 birds, I deal with enough sh.. :)


« Reply #14 on: Feb 28, 2008, 11:15 PM »

I was thinking that as well, but it renders a blank page.. Sad
Logged
Pages: [1] 2   Go Up
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP

Copyright © 2005-2008 MODxCMS, All rights reserved. Contact Us
Styles by ziworks.com

Powered by SMF 1.1.4 | SMF © 2005, Simple Machines LLC

Valid XHTML 1.0! Valid CSS!