Имам следнияд код за изкарване на 4 произволни препоръки написани от клиенти.
index.php
index.tpl
Там където започва самият div "<div class="one_fourth">" на четвъртият резултат които ми изкара трябва да добави last или по-точно да стане така:
index.php
PHP:
//Getting 4 random results from the database
$sql = mysql_query("SELECT * FROM `testimonials` ORDER BY RAND() LIMIT 0,4");
//Putting the results into an array
while($row = mysql_fetch_array($sql)){
//Putting the result into a smarty array
$result[] = $row;}
//Assing some smarty variables
$smarty->assign("result",$result); //4 random testimonials
//Display the template file
$smarty->display("index.tpl");
index.tpl
Код:
<h1>What do our clients think?</h1>
{foreach item="r" from="$result"}
<div class="one_fourth"><h6>{$r.client}</h6><p>{$r.testimonial|truncate:125}</p>
</div>
{/foreach}
Там където започва самият div "<div class="one_fourth">" на четвъртият резултат които ми изкара трябва да добави last или по-точно да стане така:
Код:
<div class="one_fourth last"></div>