在PHP(Wordpress)循环中,如何生成唯一数字序列?
如果在循环中生成一个列表,类似于:在PHP(Wordpress)循环中,如何生成唯一数字序列?,php,wordpress,loops,integer,Php,Wordpress,Loops,Integer,如果在循环中生成一个列表,类似于: <?php if ( have_posts() ) while ( have_posts() ) : the_post(); ?> <div id="slide"> <ul> <li class="slide-<?php //how can I generate an integer here ?>"> <a href="#">stuff</a></li> <
<?php if ( have_posts() ) while ( have_posts() ) : the_post(); ?>
<div id="slide">
<ul>
<li class="slide-<?php //how can I generate an integer here ?>">
<a href="#">stuff</a></li>
</ul>
</div>
我在考虑你会把一些幻灯片放在同一页上。所以我会把所有的HTML代码放在PHP代码中。诸如此类:
<?php
while ($count <= $total) {
echo "<div id=\"slide\">";
echo "<ul>";
echo "<li class=\"slide-".$count."\">";
echo "<a href=\"#\">stuff</a></li>";
echo "</ul>";
echo "</div>";
count++;
}
?>
我没有检查代码,但这只是一个想法
祝你好运。我在考虑你会把一些幻灯片放在同一页上。所以我会把所有的HTML代码放在PHP代码中。诸如此类:
<?php
while ($count <= $total) {
echo "<div id=\"slide\">";
echo "<ul>";
echo "<li class=\"slide-".$count."\">";
echo "<a href=\"#\">stuff</a></li>";
echo "</ul>";
echo "</div>";
count++;
}
?>
我没有检查代码,但这只是一个想法
祝你好运