1

I'm trying to find a way of using php's print_r to output the entries that were pulled from the entries in the database. I'm pretty much brand new to Craft cms coming from Laravel, so a common thing I've done in the past with querying the database is seeing what I got back by outputting my array using either print_r or laravel's dd($array) during testing for a sanity check. I can't seem to find an easy way of doing this in Craft. This is what I've tried so far:

{% set listItems = craft.entries().section('todoList').all() %}

{{ listItems }}

The {{ listItems }} of course gives the array to string conversion error when rendering the page, so I tried doing:

{{ listItems | join }}

but that only outputs the title of the entry. Thank you in advance for any help!

1

It looks like using {{ dump(listItems) }} gave me enough to work with. I forgot to mention I had tried this before. It didn't work the last time, but I suspect I gave it an incompatible data type.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.