The Arcive of Official vBulletin Modifications Site.It is not a VB3 engine, just a parsed copy! |
|
#1
|
||||
|
||||
![]()
Is there any way to find how many loops makes the vb:each in a template?
For example I want to do something like this HTML Code:
<vb:each from="arrayname" key="keyid" value="data"> <vb:if condition="$loops>=4"> Some HTML CODE <vb:else /> Some Other HTML CODE </vb:if> </vb:each> |
#2
|
||||
|
||||
![]()
I know this is the stupid way but it works
![]() HTML Code:
<vb:if condition="$count = 0"></vb:if> <vb:each from="array" key="arraykey" value="arrayvalue"> <vb:if condition="$count = $count + 1"></vb:if> <vb:if condition="$count <= 3"> <!-- YOUR HTML --> <vb:else /> <!-- YOUR HTML --> </vb:if> </vb:each> If anyone knows other way (exept javascript) please tell me. |
#3
|
|||
|
|||
![]() Quote:
|
#4
|
|||
|
|||
![]()
You could also use an array with numeric keys, if you can guarantee that the keys are continuous.
PHP Code:
|
#5
|
|||
|
|||
![]()
It looks like a built in method will be added into a future vBulletin version....
Check this out and don't forget to VOTE http://tracker.vbulletin.com/browse/VBIV-10883 |
#6
|
|||
|
|||
![]()
Vote added.
|
![]() |
|
|
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
![]() |
|
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|