We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 24421
    • 44 Posts
    I use the following Ditto call to get a list of the 5 latest articles:
    [[Ditto? &parents=`2`
             &summarize=`5`
             &sortBy=`createdon`
             &tpl=`Recientes_Ditto_tpl`
             &dateFormat=`%d/%m/%Y`
             &tplCurrentDocument=`Recientes_Ditto_tplCurrentDocument`]]
    It works perfectly. But I would like to see discarded the first 2 articles and display from 3 to 7 when the document ’id’ from which Ditto is called is ’1’ (home), it’s very easy to get adding the ’&start=2’ option temporally to test what happen. It work.

    Knowing that works, I have tried to get the ’&start’ option value using PHx directly call as a value:
    Test 1 - &start=[+phx:if=`[+id+]`:is=`1`:then=`2`:else=`0`+]
    Test 2 - &start=[+phx:if=`[+id+]`:is=`1`:then=``2``:else=``0``+]
    Test 3 - [+phx:if=`[+id+]`:is=`1`:then=&start=`2`:else=&start=`0`+]
    Test 4 - [+phx:if=`[+id+]`:is=`1`:then=`&start=`2``:else=`&start=`0``+]
    But it’s not working, what am I doing wrong?
    Please help.
      • 7231
      • 4,205 Posts
      Do ypu have the PHx plugin installed? The PHx feature included with Ditto are limited to the template chunks only, if you want to use PHx in other areas you will need to have it installed.
        [font=Verdana]Shane Sponagle | [wiki] Snippet Call Anatomy | MODx Developer Blog | [nettuts] Working With a Content Management Framework: MODx

        Something is happening here, but you don't know what it is.
        Do you, Mr. Jones? - [bob dylan]
        • 24421
        • 44 Posts
        Thanks, then I better use one snippet call like:
        &start=`[!StartOnHome!]`
        //and on the snippet...
        <?php $modx->documentIdentifier == '1' ? '2' : '0'; ?>