When is it advisable or prudent to use without
rather than a conditional statement to exclude something, eg a set of entries, based on one parameter?
For example, say I have real towns and fictional Towns that are listed on a related Regional page. These Towns are sorted real/fictional by a toggle field -- 0
for real, 1
for fictional.
The fictional towns are used elsewhere and should not be listed on any Regional page. In this case, should I be using if
(see below) or without
?
Here is how I am doing it right now in my Regional template:
{% if town.townFictional == 0 %}
<li>{{town.link}}</li>
{% endif %}
This is working fine, but I came across this question where using without
was suggested.
Is without
preferred in my case, and if so how do I use it? Here is my towns
variable:
{% set towns = craft.entries.section('towns').relatedTo(counties) %}