Problem with entry.hasDescendants() So I have a Structure like that


Item

Subitem | inactive
Subitem | inactive



why is item.hasDescendants() true ?

How would I do something like that the right way:

&lt;li class="{% if nav_item.hasDescendants() %}more{% endif %}"&gt;
hasDescendants() is only concerned with whether the entry actually has descendants; not whether they are enabled or not.

To determine in an entry has enabled descendants, you can do this:

{% set hasDescendants = entry.descendants.total() %}


Or in your case:

&lt;li class="{% if nav_item.descendants.total() %}more{% endif %}"&gt;


entry.descendants is an alias for EntryModel::getDescendants(), which will return a new ElementCriteriaModel prepped to return descendants of entry. By default it will only return the enabled ones, like all ElementCriteriaModel’s.