I tried to give all pages that don't have any children the class attribute "leaf".
After experimenting quite some time with this:
<div id="page"<% if Children.TotalItems < 1 %> class="leaf"<% end_if %>>
or
<div id="page"<% if !Children %> class="leaf"<% end_if %>>
or
<div id="page"<% if Children.TotalItems == 0 %> class="leaf"<% end_if %>>
which all gave a "Parse error", I finally had to use this very odd method to get it to work:
<div id="page"<% if Children.TotalItems %><% else %> class="leaf"<% end_if %>>
This doesn't seem right. What did I do wrong? There must be an easier way to accomplish this.
Any thoughts? Is it not possible to do comparisons in Silverstripe templates?