1

I was trying to follow this example from stack overflow to loop through a list of entries and output them by a custom dropdown field

{% set allEntries = craft.entries.section('resource').find() %}
{% set allEntriesByCat = allEntries|group('entry.resourceType') %}
{% for cat, entriesInCat in allEntriesByCat %}
    <h2>{{cat}}</h2>
    {% for entry in entriesInCat %}
        <article class="resource">
            <h3 class="resource__name"><a class="resource__link" href="{{entry.resourceLink}}">{{entry.title}}</a></h3>
            <div class="resource__content">{{entry.resourceContent}}</div>
        </article>
    {% endfor %}
{% endfor %}

But if I do that, I get the error: Internal Server Error Craft\EntryModel and its behaviors do not have a method or closure named "entry".

1

You have to remove the entry from your entry.resourceType

{% set allEntriesByCat = allEntries|group('resourceType') %}

will work

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.