打开article_cat.php文件
在74行左右空白处添加如下代码:
/* links */
$links = index_get_links();
$smarty->assign('img_links',
$links['img']);
$smarty->assign('txt_links', $links['txt']);
在最后的112行左右下面添加如下代码:
function index_get_links() {
$sql = 'SELECT link_logo, link_name, link_url FROM ' . $GLOBALS['ecs']->table('friend_link') . ' ORDER BY show_order';
$res = $GLOBALS['db']->getAll($sql);
$links['img'] = $links['txt'] = array();
foreach ($res AS $row) {
if (!empty($row['link_logo']))
{
$links['img'][] = array('name' => $row['link_name'],
'url' => $row['link_url'],
'logo' => $row['link_logo']);
}
else
{
$links['txt'][] = array('name' => $row['link_name'],
'url' => $row['link_url']);
}
}
return $links;
}
然后打开模版文件 article_cat.dwt
在中间
<!-- #EndLibraryItem --><!-- #BeginLibraryItem "/library/page_footer.lbi" -->
这个代码前面加上下面的代码:
<!-- #EndLibraryItem --><!--{if $img_links or $txt_links }-->
<div style="border:1px solid #CCC;margin:5px auto 10px auto;padding:5px;">
<!-- {if $img_links} --> <div style="padding:3px;">
<!--开始图片类型的友情链接{foreach from=$img_links item=link}-->
<span style="width: 100px; text-align: center">
<a href="{$link.url}" target="_blank" title="{$link.name}"><img src="{$link.logo}" width="88" height="31" alt="{$link.name}" border="0" /></a>
</span>
<SCRIPT src="themes/default/friendship.js">
</SCRIPT>
<!--结束图片类型的友情链接{/foreach}-->
</div>
<!-- {/if} -->
<!-- {if $txt_links} -->
<div style="padding:3px;">
<!--开始文字类型的友情链接{foreach from=$txt_links item=link}-->
<span style="width: 100px; text-align: center"> [<a href="{$link.url}" target="_blank" title="{$link.name}">{$link.name}</a>]</span>
<!--结束文字类型的友情链接{/foreach}-->
</div>
<!-- {/if} -->
</div>
<!--{/if}-->