2

How do I add a value to the {count} variable?

I'm trying to do this:

{exp:channel:entries channel='links' orderby='link_order' sort='asc' dynamic='no'  category='12'}
<div class="item" id="pane-{count+15}" style="display: none;">
    <!-- stuff here -->
</div>
{/exp:channel:entries}

I want the HTML to come out like this:

<div class="item" id="pane-16" style="display: none;">
    <!-- stuff here -->
</div>
<div class="item" id="pane-17" style="display: none;">
    <!-- stuff here -->
</div>
<div class="item" id="pane-18" style="display: none;">
    <!-- stuff here -->
</div>
4

By default, EE is support calculations in conditions only. For other cases you can use MX Calc

{exp:channel:entries channel='links' orderby='link_order' sort='asc' dynamic='no'  category='12' parse="inward"}
<div class="item" id="pane-{exp:mx_calc expression='{count}+15'}" style="display: none;">
    <!-- stuff here -->
</div>
{/exp:channel:entries}
1
  • 1
    There are few math / calculation add-ons for EE (search results), but MX Calc is most of the times choice #1 – Yuri Salimovskiy Feb 3 '15 at 9:24

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.