<div id="sidebox">


<div class="signupbox">
    <p>轻松赚钱</p>
    <p><a href="signup.php" target="_blank"><img src="<?php echo THEME_PATH; ?>/images/btn.png" title="点此注册" border="0" width="100%" /></a></p>
</div><!--end.signupbox-->


<table id="searchBox">
<form name="searchForm" method="GET" action="" onSubmit="if(this.so.value=='Search...') {alert('请输入搜索条件！');return false;}">
<input name="md" type="hidden" value="Affiliate_PZone_Views_Post" />
<tr>
    <td><input id="so" name="so" type="text" value="Search..." maxlength="20" onfocus="if(this.value=='Search...') this.value=''" onblur="if(this.value=='') this.value='Search...'" /></td>
    <td><input type="image" src="<?php echo THEME_PATH; ?>/images/searchbutton.gif" />
    </td>
</tr>
</form>
</table><!--end#searchBox-->


<div class="articlebox">
    <div class="title">佣金龙虎榜</div>
    <div class="lists">
    <?php
        //获取总业绩排行榜
        $rs = $this->a_core->getTopByTotal(10);
        if(!$rs) {
            echo '无可用数据';
        }else {
            $data = array();
            foreach($rs as $key=>$row) {
                $data[] = sprintf('%d、%s　%.2f',$key+1,$row['name'],$row['total']).'元';
            }
            echo join('<br />',$data);
        }
    ?>
    </div>
</div><!--end.articlebox-->


<div class="articlebox">
    <div class="title">最新文章</div>
    <div class="lists">
    <?php
        //获取文章列表示例
        $params = array(
            'paged'=>true,  //是否分页
            'pageid'=>1,    //当前页码
            'limit'=>10,    //每页显示条数
            //'cateid'=>array('syscates','pzonefaq')   //文章分类，为空则显示所有分类，也可直接传入单个分类ID的字符串
        );
        $posts = $this->a_core->getPosts($params);
        if($posts) {
            $s_template = '<a href="index.php?md=Affiliate_PZone_Views_Post&cateid=%s" target="_self">[%s]</a> <a href="index.php?md=Affiliate_PZone_Views_Post&id=%s" target="_self" title="%s">%s</a>&nbsp;<span class="font2">%s</span><br />';
            foreach($posts['articles'] as $row) {
                echo sprintf($s_template,$row['cateid'],$row['catename'],$row['ID'],$row['title'],$row['title'],$row['postime']);
            }
        }else {
            echo '暂无可用数据';
        }
    ?>
    </div>
</div><!--end.articlebox-->

<div class="articlebox">
    <div class="title">友情链接</div>
    <div class="lists">
    <?php
    //获取并显示友情链接
    $links = $this->a_core->getFriendLinks();
    if(!$links) {
        echo '暂无链接，欢迎联系交换友情链接。';
    }else {
        //LOGO链接
        if(is_array($links['logo']))
        foreach($links['logo'] as $row) {
            echo sprintf('<div class="flink_img_item"><a title="%s" href="%s" target="_blank"><img src="%s" width="90" height="25" /></a></div>',$row['sitetitle'],$row['siteurl'],$row['logourl']);
        }
    }


    //文字链接
    if(is_array($links['word'])) {
        foreach($links['word'] as $row) {
            $tmp[] =  sprintf('<a title="%s" href="%s" target="_blank">%s</a>',$row['sitetitle'],$row['siteurl'],$row['sitetitle']);
        }
        echo '<div class="clear_div"></div>';
        echo join('&nbsp;&nbsp;|&nbsp;&nbsp;',$tmp);
    }
    ?>
    </div>
</div><!--end.articlebox-->

</div><!--end#sidebox-->