Hi, I am quite new to ModX, and i started templating today:
1/
I am trying to get the loop index of ditto, like the loop.index in jinja, is there something similar?
2/
can i test a variable :
if ( [+descriptionItem+] != null) { do something }
Assuming we are talking about MODx Evo (if you have installed Revo, forget Ditto, look at getResources instead:
1) Ditto’s index variable appears as the placeholder [+ditto_iteration+]
2) Yes. Ditto has a built-in copy of PHx ("placeholders extended"), which includes the opportunity to conditionally modify the output of placeholders. There’s good documentation for it in the old Wiki.