php - pyrocms assign count to variable -


i check if last post loop. using pyrocms. problem if using helper:count 2 times not working correctly. how can assign helper:count variable , use later variable. possible?

{{ blog:posts limit="5" order-by="title" order-dir="desc" }}  {{ if { helper:count mode="subtract" } == blog:all_posts}}                  <li>                     <a href="{{ url }}" title="read more about: {{ title }}">                     <span class="naslovna_datum_novice">{{ helper:date format="d.m.y" timestamp=created_on }} - </span>                         {{ title }}                     </a>                 </li>                  {{ elseif { helper:count mode="subtract" } == 5 }}                  <li>                     <a href="{{ url }}" title="read more about: {{ title }}">                     <span class="naslovna_datum_novice">{{ helper:date format="d.m.y" timestamp=created_on }} - </span>                         {{ title }}                     </a>                 </li>                  {{ else }}                  <li class="pikce_spodaj">                     <p>                         <a href="{{ url }}" title="read more about: {{ title }}">                         <span class="naslovna_datum_novice">{{ helper:date format="d.m.y" timestamp=created_on }} - </span>                         {{ title }}                         </a>                     </p>                 </li>                     {{ endif }}  {{ /blog:posts }}    

so how assign {{ helper:count mode="subtract" }} variable?? how assign variable?

there's simpler way; streams core code adds last property final item in array - source code - can query conditional:

{{ if last }} foo {{ endif }} 

(the source code

here's working example blogs i've tested:

{{ blog:posts limit="5" order_by="title" }}     <h2>{{ title }}</h2>      [...]      {{ if last }}<p>this last item</p>{{ endif }} {{ /blog:posts }} 

also, nick points out, can have more 1 counter.


Comments

Popular posts from this blog

java - nested exception is org.hibernate.exception.SQLGrammarException: could not extract ResultSet Hibernate+SpringMVC -

sql - Postgresql tables exists, but getting "relation does not exist" when querying -

asp.net mvc - breakpoint on javascript in CSHTML? -