Esempio n. 1
0
 public function index()
 {
     $slug = $tag ? $tag : get_safe_replace($_REQUEST['tag']);
     $module = get_safe_replace($_REQUEST['module']);
     $module = $module ? ucfirst($module) : '';
     if (C('URL_MODEL') == 0) {
         $moduleid = intval($_REQUEST['moduleid']);
         $module_name = $moduleid ? $this->module[$moduleid]['name'] : '';
         $module = $module ? $module : $module_name;
         $p = max(intval($_REQUEST[C('VAR_PAGE')]), 1);
     } elseif ($this->mod[ucfirst($slug)]) {
         $module = ucfirst($slug);
         unset($slug);
     }
     $prefix = C("DB_PREFIX");
     $Tags = M('Tags');
     $Tags_data = M('Tags_data');
     $where = APP_LANG ? " lang=" . LANG_ID : 1;
     if ($slug) {
         $module = $module ? $module : 'Article';
         $moduleid = $this->mod[$module];
         $data = $Tags->where($where . " and moduleid = {$moduleid} and slug='" . $slug . "'")->find();
         $this->assign('seo_title', $data['name']);
         $this->assign('seo_keywords', $data['name']);
         $this->assign('seo_description', $data['name']);
         if ($data) {
             $tagid = $data['id'];
             $this->assign('data', $data);
             $mtable = $prefix . strtolower($module);
             $count = $Tags_data->table($prefix . 'tags_data as a')->join($mtable . " as b on a.id=b.id ")->where("a.tagid=" . $tagid)->count();
             if ($count) {
                 import("@.ORG.Page");
                 $listRows = C('PAGE_LISTROWS');
                 //C('PAGE_LISTROWS')
                 $page = new Page($count, $listRows, $p);
                 $page->urlrule = TAGURL($data, 1);
                 $pages = $page->show();
                 $field = 'b.id,b.catid,b.userid,b.url,b.username,b.title,b.keywords,b.description,b.thumb,b.createtime';
                 $list = $Tags_data->field($field)->table($prefix . 'tags_data as a')->join($mtable . " as b on a.id=b.id")->where($where . " and a.tagid=" . $tagid)->order('b.listorder desc,b.id desc')->limit($page->firstRow . ',' . $page->listRows)->select();
                 $this->assign('pages', $pages);
                 $this->assign('list', $list);
             }
         }
     } else {
         $moduleid = $this->mod[$module];
         $where .= $moduleid ? ' and moduleid=' . $moduleid : '';
         $count = $Tags->where($where)->count();
         if ($count) {
             import("@.ORG.Page");
             $listRows = 50;
             $page = new Page($count, $listRows);
             $page->urlrule = TAGURL(array('moduleid' => $moduleid), 1);
             $pages = $page->show();
             $list = $Tags->where($where)->order('id desc')->limit($page->firstRow . ',' . $page->listRows)->select();
             foreach ($list as $key => $r) {
                 $list[$key]['module'] = $this->module[$r['moduleid']]['name'];
             }
             $this->assign('pages', $pages);
             $this->assign('list', $list);
         }
     }
     $this->assign('bcid', 0);
     //顶级栏目
     $template = $slug ? 'list' : 'index';
     $this->display("Tags:" . $template);
 }
"><?php 
echo L(more);
?>
>></a></span><b><?php 
echo L(tags);
?>
</b><em>Tags</em></h3><ul><?php 
$_result = M("Tags")->where(" lang=1")->order("id desc")->limit("12")->select();
if ($_result) {
    $i = 0;
    foreach ($_result as $key => $r) {
        ++$i;
        $mod = $i % 2;
        ?>
<a href="<?php 
        echo TAGURL($r);
        ?>
"><?php 
        echo $r["name"];
        ?>
</a>&nbsp;<?php 
    }
}
?>
</ul></div></div><div class="h10"></div><div class="box"><div class="b1 links"><h3 class="tit"><span></span><b><?php 
echo $T["right_name_3"];
?>
</b><em>links</em></h3><div class="h10"></div><ul class="pic"><?php 
$_result = M("Link")->field("*")->where(" status = 1  and lang=1 and typeid=2 and  linktype=2")->order("id desc")->limit("10")->select();
if ($_result) {
    $i = 0;