我正在使用Prestashop`模板,因此我添加以下代码以显示带有产品的类别。
<div class="wrapper" itemscope itemtype="http://schema.org/EducationEvent">
<ul class="accordion">
<li class="nav-dropdown">
<input type="radio" name="accordion" id="{$subcategory.name}" checked="false"/>
<label for="{$subcategory.name}">
<span class="subcat"><h1>{$subcategory.name}</h1></span>
<span class="descsubcat">{$subcategory.description|truncate:50:'...'}</span>
<br />
</label>
<div class="cursos">
{foreach from=$products item=product name=products}
{if $products != ''}
<div class="float_left">
<div itemprop="name" class="titcurs">
<a href="{$product.link|escape:'htmlall':'UTF-8'}" title="{$product.name}">
<h2>{$product.name|escape:'htmlall':'UTF-8'}</h2>
</a>
</div>
<div itemprop="description">
<p class="product_desc">
<a href="{$product.link|escape:'htmlall':'UTF-8'}" title="{$product.description_short|strip_tags:'UTF-8'|truncate:360:'...'}" >
{$product.description_short|strip_tags:'UTF-8'|truncate:360:'...'}
</a>
</p>
</div>
</div>
<div class="float_right">
<div class="fitxa">
<a class="button lnk_view" href="{$product.link|escape:'htmlall':'UTF-8'}" title="{l s='Ver programa del curso'}">
{l s='Ver programa del curso'}
</a>
</div>
<div id="leyendacat" class="rte align_justify">{$product.leyendacat}</div>
</div>
<div class="lower_line"></div>
{/if}
{/foreach}
</li>
</ul>
</div>
但似乎主要问题在于这一部分:
<input type="radio" name="accordion" id="{$subcategory.name}" checked="false"/>
<label for="{$subcategory.name}">
<span class="subcat"><h1>{$subcategory.name}</h1></span>
<span class="descsubcat">{$subcategory.description|truncate:50:'...'}</span>
<br />
</label>
我发现,为了让它工作,我只需要添加checked="false"
函数,如前所示,但它让我显示列表的最后一个类别打开,我不想显示最后一个类别它是。
我发现了一些关于它的帖子但是没有按照我想要的方式工作。