Ditto debugging features
Adding the parameter &debug=`1` to your Ditto call generates an informative report telling how the snippet is seeing your parameters and what is being retrieved and selected for display on the basis of them. This information can give you valuable clues about what needs correction when things go wrong. It can also give you a better idea of how Ditto operates when things go right!
When the parameter is set to `1`, two lines are added at the top of the output page. Open debug console opens in a new window of its own. The other link offers to save the same information in an HTML file.
Clicking on Open debug console displays a summary in five or six tabs:
- Info tells you what version of Ditto you are using, the total number of documents retrieved from the database by your call, the first and last to be displayed on the current page, and the IDs of the retrieved documents. It also indicates which field is being used for sorting, and in which direction.
- Parameters lists the parameters as received - but it won't tell you if they are valid or not.
- Fields lists all the fields and template variables used to generate the result, split into "display", "backend" and "retrieved" (looks useful, though I'm not sure what the divisions mean).
- Templates shows the HTML code that Ditto is using to insert the placeholders into the output. This may have been pulled in from various chunks, files and inline code.
- Prefetch Data: this tab appears if you have applied sorting or filtering. It lists the IDs of all the documents retrieved from the database and the IDs of the documents matching the filter criteria, followed by the field and template variable data for all the retrieved documents.
- Retrieved Data lists all the documents retrieved from the database, with the fields selected for display in the template. If sorting has been specified, a field called ditto_sort is among the fields, starting from zero and running through a continuous sequence to the last retrieved document. You can access this field in a template as the placeholder [+ditto_sort+].
Open Debug Console
Save Debug ConsoleQuisque consectetur, ITEM 511 quam sit amet fringilla
01-May-07 00:00
Aenean vitae ITEM 510 justo vitae turpis pellentesque
Duis tristique ITEM 512 urna id metus. Maecenas
Note: if you just see your output in a new window instead of the debug console when you click on Open debug console, try adjusting the cache arrangements. Either set the Ditto call to be uncached with [!Ditto?...!], or leave it uncached and clear the Cacheable checkbox in Page Settings.