我在我的prestashop中使用了博客模块,heree是列出帖子的文件,请你帮我做一个网格视图每行2或3个帖子
{if isset($nbposts)}
<!-- Post list -->
<div id="post_list" class="post-list">
{foreach from=$nbposts item=post name=nbposts}
<section class="a-post">
<div class="date">
<span class="month">{$post.date_add|date_format:"%b"}</span>
<span class="day">{$post.date_add|date_format:"%d"}</span>
<span class="year">{$post.date_add|date_format:"%Y"}</span>
</div>
<div class="name">
<a href="{$post.link|escape:'htmlall':'UTF-8'}" title="">{$post.name|escape:'htmlall':'UTF-8'}</a>
<div class="meta">
<span class="author">{$post.author|escape:'htmlall':'UTF-8'}</span>
<span class="in-cols">{$post.in_collections|escape:'htmlall':'UTF-8'}</span>
{if $post.num_comment > 0}<span class="num-comment">{$post.num_comment} {l s='Comment(s)' mod='nextblog'}</span>{/if}
</div>
</div>
{if $post.image}
<div class="image">
<a href="{$post.link|escape:'htmlall':'UTF-8'}" title="{$post.name|escape:'htmlall':'UTF-8'}">
<img src="{$post.image}" alt="{$post.name|escape:'htmlall':'UTF-8'}" />
</a>
</div>
{/if}
<div class="description nsb">
{$post.description_short|escape:'UTF-8'}
</div>
<div class="view">
<a class="button post-button" href="{$post.link|escape:'htmlall':'UTF-8'}" title="{l s='Read More' mod='nextblog'}">{l s='Read More' mod='nextblog'}</a>
</div>
</section>
{/foreach}
</div>
<!-- /Post list -->
{/如果}
答案 0 :(得分:0)
如果您使用的是default-boostrap主题,请使用此代码。
如果您想要连续发布2个帖子,请在部分类中使用“col-md-6”(如示例所示),如果3只是使用“col-md-4”而不是。
{if isset($nbposts)}
<!-- Post list -->
<div id="post_list" class="post-list col-md-12">
{foreach from=$nbposts item=post name=nbposts}
<section class="a-post col-md-6">
<div class="date">
<span class="month">{$post.date_add|date_format:"%b"}</span>
<span class="day">{$post.date_add|date_format:"%d"}</span>
<span class="year">{$post.date_add|date_format:"%Y"}</span>
</div>
<div class="name">
<a href="{$post.link|escape:'htmlall':'UTF-8'}" title="">{$post.name|escape:'htmlall':'UTF-8'}</a>
<div class="meta">
<span class="author">{$post.author|escape:'htmlall':'UTF-8'}</span>
<span class="in-cols">{$post.in_collections|escape:'htmlall':'UTF-8'}</span>
{if $post.num_comment > 0}<span class="num-comment">{$post.num_comment} {l s='Comment(s)' mod='nextblog'}</span>{/if}
</div>
</div>
{if $post.image}
<div class="image">
<a href="{$post.link|escape:'htmlall':'UTF-8'}" title="{$post.name|escape:'htmlall':'UTF-8'}">
<img src="{$post.image}" alt="{$post.name|escape:'htmlall':'UTF-8'}" />
</a>
</div>
{/if}
<div class="description nsb">
{$post.description_short|escape:'UTF-8'}
</div>
<div class="view">
<a class="button post-button" href="{$post.link|escape:'htmlall':'UTF-8'}" title="{l s='Read More' mod='nextblog'}">{l s='Read More' mod='nextblog'}</a>
</div>
</section>
{/foreach}
</div>
<!-- /Post list -->
{/if}