How do I order by _entry type_ when looping through entries in a template? I currently have multiple sections like so:

{% for craft.entries.section('mySection').type('oneType')... %}
   ... {% endfor %}
{% for craft.entries.section('mySection').type('anotherType')... %}
   ... {% endfor %}


But I would rather have a single loop like this:

{% for craft.entries.section('mySection').order('type, title')... %}


However, the type referred to in order() will in the DB query refer to craft_elements.type which in this case always will be Entry.

Is it possible to order by entry type?
You could use Craft's group filter for this, but you'll lose the ability to
use the paginate tag to paginate your entries by doing so.

{% set entries = craft.entries.section('mySection').order('title') %}
{% set entriesByType = entries|group('type') %}

{% for type, entriesInType in entriesByType %}
    &lt;h3&gt;{{ type }}&lt;/h3&gt;

    {% for entry in entriesInType %}
        &lt;p&gt;{{ entry.title }}&lt;/p&gt;
    {% endfor %}
{% endfor %}