We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 18641
    • 22 Posts
    Hi Guys,

    Not really sure how to approach this and was wondering if anyone could offer some help or suggestions.

    I’m using ditto to list some events using a custom Date TV. What I’d like to be able to do is automatically number the events. For example:

    2009 Event 3: www.gohere.co.uk
    2008 Event 2: www.gohere.co.uk
    2007 Event 1: www.gohere.co.uk

    Note that event 3 is at the top and is the most recent event listed, event 1 was the first event we listed.

    How would I go about getting ditto to produce the Numbering that way automatically? I thought maybe just use Menu Index, but would like something a little more automagik. Maybe @EVAL? It needs occur based on the date set in my custom date TV, that way if I switch around the dates of some of the events the Ditto output will be nicely renumbered.

    I can’t even work out if this is easy or not, my brain has let me down grin Any help would be appreciated.

    Matt.
      • 16278
      • 928 Posts
      You could try a little Ditto placeholder + PHx magic. Ditto’s ordering index ditto_sort can be used as a placeholder, and you get the total number of items retrieved as [+total+] when &paginate=`1`. Throw in PHx’s math extender, and you can put this in your template:
      Descending order = [+phx:math=`[+total+]-[+ditto_sort+]`+]

      I think you need the Ditto call to be uncached for pagination to work. I haven’t looked at whether you need that for [+total+] to be available.
      cool
      KP
        • 18641
        • 22 Posts
        Hi KP,

        Thanks so much, I haven’t installed PHx yet but I am certainly going to give this a try – I’ll post back when I do, thanks for the help!

        +Matt