干草每个人都需要一点帮助,因为我是编码新手。
例如,每次数字更改时是否可以添加标题。
在我的节目页面上有剧集块,显示可用的季节和剧集,它们的基础是这样的
Season 1. Episode 1
Season 1. Episode 2
Season 1. Episode 3
Season 2. Episode 1
Season 2. Episode 2
Season 2. Episode 3
我想要做的是每次季节编号更改时添加一个标题,说明它是什么季节
第1季
Season 1. Episode 1
Season 1. Episode 2
Season 1. Episode 3
第2季
Season 2. Episode 1
Season 2. Episode 2
Season 2. Episode 3
谁能帮我实现这是我的代码。
<ul class="col2">
{foreach from=$episodes key=id item=val name=episode_loop}
<li>
<h5 class="episode_item">
{if $global_settings.seo_links}
<a class="link" href="{$baseurl}/{$routes.show}/{$val.perma}/season/{$val.season}/episode/{$val.episode}" title="{$lang.show_episode_title|replace:'#season#':$val.season|replace:'#episode#':$val.episode}">{$lang.show_episode_title|replace:'#season#':$val.season|replace:'#episode#':$val.episode}</a>
{else}
<a class="link" href="{$baseurl}/index.php?menu=episode&perma={$val.perma}&season={$val.season}&episode={$val.episode}" title="{$lang.show_episode_title|replace:'#season#':$val.season|replace:'#episode#':$val.episode}">{$lang.show_episode_title|replace:'#season#':$val.season|replace:'#episode#':$val.episode}</a>
{/if}
</h5>
</li>
{if $smarty.foreach.episode_loop.iteration % 4 eq 0}<div class="clear"></div>{/if}
{/foreach}
</ul>
请有人帮助我
谢谢