我在 Code Igniter Framework 中运行的 smarty 模板中有一段代码,显示用户评分和评论。由于 foreach() 循环,所有的评论 div 会立即加载。我想要一个 JQuery 在页面加载时加载 5 个结果,然后在页面底部有一个按钮,每次按下时我可以再加载 5 个。谁能帮帮我?
{{ if ($comments_count > 0): }}
{{ foreach ($comments as $index=>$comment): }}
<div class="notepad">
<div class="notepad-heading">
<span class="evaluation_comment_date">{{= timespan(strtotime($comment- >date_time_added),now()).' '.lang('evaluation_ago') }}
</div>
<table width="750" border="0" align="left">
<tr>
<td width="154" valign="top"><h6 style="display:inline">{{= lang('comment_rating') }}</h6></td>
<td width="83"><img style="display:inline" src="{{= template_path() . 'images/' . $comment->rating_image }}" alt=""/></td>
<td width="38" rowspan="5"> </td>
<td width="307" colspan="5" rowspan="5" valign="top">“{{= $comment->quotation }}”</td>
</tr>
<tr>
<td valign="top"><h6 style="display:inline">{{= lang('comment_rating2') }}</h6> </td>
<td valign="top"><img style="display:inline" src="{{= template_path() . 'images/' . $comment->rating_image2 }}" alt=""/></td>
</tr>
<tr>
<td valign="top"><h6 style="display:inline">{{= lang('comment_rating3') }}</h6> </td>
<td valign="top"><img style="display:inline" src="{{= template_path() . 'images/' . $comment->rating_image3 }}" alt=""/></td>
</tr>
<tr>
<td valign="top"><h6 style="display:inline">{{= lang('comment_rating4') }}</h6> </td>
<td valign="top"><img style="display:inline" src="{{= template_path() . 'images/' . $comment->rating_image4 }}" alt=""/></td>
</tr>
<tr>
<td valign="top"><h6 style="display:inline">{{= lang('comment_rating5') }}</h6> </td>
<td valign="top"><img style="display:inline" src="{{= template_path() . 'images/' . $comment->rating_image5 }}" alt=""/></td>
</tr>
</table>
</div>
{{ if ($index+1 != count($comments)): }}<div class="list_separator"></div>{{ endif }}
{{ endforeach }}
{{ else: }}
<h3>{{= lang('evaluation_no_comments') }}</h3>
{{ endif }}