views:

23

answers:

1

i want to compare num and {{buildSummary_list.number}}, but why it is not work? And i got an error "Could not parse the remainder: '{{buildSummary_list.number}}' from '{{buildSummary_list.number}}'"...

{% for num in buildSummary_list.paginator.page_range %}
    {% ifequal num {{buildSummary_list.number}} %}
        <b>{{num}}</b>
    {% endifequal %}
    {% ifnotequal num {{buildSummary_list.number}} %}
        <a href="?page={{num}}"><b>{{num}}</b></a>
    {% endifnotequal %}

{% endfor %}

I want to make the pagination have effect: pre << 1 2 3 4 5 6 >> next

I my code can run, can it make this effect? thanks:D

+4  A: 

Inside a {% %} tag, variables aren't surrounded by {{. Try this:

{% ifequal num buildSummary_list.number %}

Also, it looks like your two comparisons can be joined with an else:

{% for num in buildSummary_list.paginator.page_range %}
    {% ifequal num buildSummary_list.number %}
        <b>{{num}}</b>
    {% else %}
        <a href="?page={{num}}"><b>{{num}}</b></a>
    {% endifequal %}
{% endfor %}
Ned Batchelder
Wish I could give you a +5. That is not mentioned ANYWHERE! looking again the docs now it seems obvious, but raaaah...
pfctdayelise