Posted By

assbach on 02/16/07


Tagged

Smarty count counter lists


Versions (?)

Who likes this?

1 person have marked this snippet as a favorite

Bunker


several counters


 / Published in: Smarty
 

URL: http://smarty.php.net/manual/de/language.function.counter.php

I used this for a numbered FAQ list. To be flexible when answers are taken out or moved in position or put in between... you don't have to worry about the numbers, cause they are dynamically parsed this way.

3 counters used in example here.

  1. <ol>
  2. <li><a href="#{counter name=list start=1}">bla</a></li>
  3. <li><a href="#{counter name=list}">bla</a></li>
  4. <li><a href="#{counter name=list}">bla</a></li>
  5.  
  6. </ol>
  7.  
  8. <a name="{counter name=anchors start=1}"></a>
  9. <p><div class="num">{counter name=answers}</div><h3>bla</h3></p>
  10. <p>answer</p><hr />
  11.  
  12. <a name="{counter name=anchors}"></a>
  13. <p><div class="num">{counter name=answers}</div><h3>bla</h3></p>
  14. <p>answer</p><hr />
  15.  
  16. <a name="{counter name=anchors }"></a>
  17. <p><div class="num">{counter name=answers}</div><h3>bla</h3></p>
  18. <p>answer</p><hr />

Report this snippet  

You need to login to post a comment.