鍍金池/ 問答/PHP/ typecho 如何在主循環(huán)中獲取到當(dāng)前元素的index

typecho 如何在主循環(huán)中獲取到當(dāng)前元素的index

需求

希望在文章前加一個(gè)倒序的列表。

不用CID的原因是CID 不連續(xù)

相關(guān)代碼

<?php while($this->next()): ?>
        <article class="post" itemscope itemtype="http://schema.org/BlogPosting">
            <h2 class="post-title" itemprop="name headline"><a itemprop="url" href="<?php $this->permalink() ?>"><?php $this->title() ?></a></h2>
        </article>
    <?php endwhile; ?>

預(yù)期解答

變量名,如$this->index()

回答
編輯回答
冷溫柔
$this->sequence
2017年9月10日 03:25