开发者

Movable Type: MTIf not working under MTSubCategories?

I'm trying to insert UL on every 20th sub category label. This code below doesn't seem to work. It only exports list of sub categories without the UL in it's right place.

Any one know what would be wrong?

<MTTopLevelCategories>
<ul>
<MTSubCategories>
<mt:If name="__counter__" op=开发者_如何转开发"%" value="20" eq="1">
<mt:If name="__counter__" ne="1">
</ul>
<ul></mt:If></mt:If>
<li><$MTCategoryLabel$></li>
</MTSubCategories>
</ul>
</MTTopLevelCategories>

My testing environment: Movable Type 5.01 PHP 5.2.11 MySQL 5 Perl 5.8.9


From what I recall and according to the "Proposal:Iterator template tag consistency" wiki page, the __counter__ meta variable is not available under <mt:SubCategories>. Unfortunately, MT lacks consistent use of the meta variables, but you can create your own counter variable to do the same thing.

<MTTopLevelCategories>
  <$mt:SetVar name="subcatcount" value="1"$>
  <ul>
    <MTSubCategories>
      <mt:If name="subcatcount" op="%" value="20" eq="1">
        <mt:If name="subcatcount" ne="1">
          </ul>
          <ul>
        </mt:If>
      </mt:If>
      <li><$MTCategoryLabel$></li>
      <$mt:SetVar name="subcatcount" value="1" op="add"$>
    </MTSubCategories>
  </ul>
</MTTopLevelCategories>
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜