本文中的这个代码很小,只能显示一个分类(子分类或父分类都可以),推荐分类的ID需要在代码中加入进去
代码:
-
<div class="centerBoxWrapper" id="feacat">
-
<h2 class="centerBoxHeading">Featured Category</h2>
-
<?php
-
$feacatARR = array("3","4","5","6","","","","","");
-
-
foreach($feacatARR as $feaID){
-
$sql_feaimg = "select c.categories_image from " . TABLE_CATEGORIES . " c where c.categories_id = '" . $feaID . "'";
-
$categories_img = $db->Execute($sql_feaimg);
-
echo '<div class="feacatcontent centeredContent back" style=" width:25%;">';
-
echo '<a href="'. zen_href_link(FILENAME_DEFAULT,'cPath='.$feaID) .'">' . zen_image(DIR_WS_IMAGES . $categories_img->fields['categories_image'], zen_get_categories_name($feaID), 150, 150) . '</a>';
-
echo '<h3 class="itemTitle"><a href="'. zen_href_link(FILENAME_DEFAULT,'cPath='.$feaID) .'">' . zen_get_categories_name($feaID) . '</a></h3>';
-
echo '</div>';
-
}
-
?>
-
</div>
也可以新建一个php文件,把这段代码贴进去,然后在tpl_index_default.php中调用那个文件即可。
效果如下图