Home >Backend Development >PHP Tutorial >destoon implements the method of calling the self-increasing number starting from 1, destoon_PHP tutorial
The example in this article describes the method of calling destoon to increase the number starting from 1, which has certain practical value when making data calls. I hope it will be helpful to everyone's destoon development. The specific method is as follows:
Example function: destoon calls the increment number starting from 1.
The specific code is as follows:
<!--{php $tags=tag("moduleid=14&length=46&condition=status=3&pagesize=10&order=hits desc&template=null");}--> {loop $tags $k $t} <li>{php $k = ++$k;} <a href="{$t[linkurl]}" rel="external nofollow" target="_blank" class="item"> <span class="num">{$t[hits]}</span> <i class="icon icon2">{$k++}</i> <span class="txt f-ib f-thide">{$t[title]}</span> </a> </li> {/loop}
I want to output this $i++ in the template; how to put {loop $tags $i $t}{$i++}imgUrl[{$i}]='{$t[thumb]}';imgLink[{$i}] ='{$t[linkurl]}';imgText[{$i}]='{$t[alt]}';{/loop}or {loop $tags $i $t}imgUrl[{$i++}] ='{$t[thumb]}';imgLink[{$i++}]='{$t[linkurl]}';imgText[{$i++}]='{$t[alt]}';{/loop } does not work
To call information of a certain category, pass the catid parameter in the tag. For example, &catid=5 means calling all information with category ID 5. If calling multiple categories, separate the category IDs with commas. For example, &catid=5,6,7 means calling all information with category IDs 5, 6, and 7. Category calls include subcategory information by default. If you do not need to include subcategories, you can set the &child=0 parameter. For example, &catid=5&child=0 means that only the information with category ID 5 is called, excluding the information of subcategories.