public function init() { self::$REQUEST = self::getGet(); if (isset(self::$REQUEST['majory'])) { self::$MAJORY = CategoryNamespace::getMajoryById(self::$REQUEST['majory']); $this->assign('majory', self::$MAJORY); } if (!isset(self::$REQUEST['kw'])) { $this->assign('kw', '死神'); } }
public function defaultAction() { $result['image'] = true; $result['top_image'] = IndexPageConfig::$IMAGE_TOP; $this->orgWord = HttpNamespace::getGET('kw'); $this->typeId = HttpNamespace::getGET('type'); $this->params['query'] = $this->orgWord; //搜索作者 if ($this->typeId == 'author') { $this->params['author'] = true; //通过uid搜索作者 } elseif (strtolower($this->typeId) == 'uid') { $user = UserNamespace::getUserById($this->orgWord); if ($user) { $this->params['uid'] = true; $this->params['username'] = $user['nick_name']; $this->orgWord = $this->params['username']; } //搜索日记本通过id } elseif (strtolower($this->typeId) == 'bookid') { $this->params['bookid'] = true; $book = DiaryBookNamespace::getUserById($this->orgWord); if ($book) { $this->params['diarybook'] = $book['book_name']; $this->orgWord = $this->params['diarybook']; } //搜索日记本通过kw } elseif (strtolower($this->typeId) == 'bookname') { $this->params['bookname'] = true; //搜索个关键词 } else { $this->typeId = (int) $this->typeId; $pa = CategoryNamespace::getById($this->typeId); $this->type = $pa['type']; $this->params[$pa['type']] = $pa; } $page = HttpNamespace::getGET('p'); list($result['article'], $result['count'], $this->cutWord) = DBXapian::searchByQuery($this->params, $page, self::$PAGE_SIZE); $result['cutword'] = $this->createUrlByWord($this->cutWord); $result['kw'] = $this->orgWord; $result['title'] = $this->orgWord; $result['type_id'] = $this->typeId; $result['page'] = $this->_showPage($result['count']); $this->assign($result); $this->display(); }
private function _returnMsg() { $flag = true; if ($this->MsgType == 'text') { $id = $this->msg['Content']; $cateogory = CategoryNamespace::getCategoryById($id); $majory = CategoryNamespace::getMajoryById($id); if ($cateogory) { // if ($cateogory['id'] == 400) { } $this->article = CommonNamespace::getNewArticle($cateogory['id'], null, 8); $this->title = $cateogory['name']; $this->url = 'http://datougou.cn/diary/index.php/category/?category=' . $cateogory['id']; } elseif ($majory) { $this->article = CommonNamespace::getNewArticle($majory['parent']['id'], $majory['id'], 8); $this->title = $majory['parent']['name'] . ' - ' . $majory['name']; $this->url = 'http://datougou.cn/diary/index.php/majory/?majory=' . $majory['id']; } else { $flag = false; } } elseif ($this->MsgType == 'event' && strtolower($this->msg['Event']) == 'subscribe') { //$this->article = IndexPageConfig::$TOP_ARTICLE; $this->title = '欢迎关注大头狗日记散文小站'; $this->url = 'http://datougou.cn'; } if ($flag) { $content = $this->_makeNews(); } else { $content = $this->makeText(); } //$content = $this->_makeNews(); file_put_contents(dirname(__FILE__) . '/test.txt', $GLOBALS["HTTP_RAW_POST_DATA"] . "\r\n", FILE_APPEND); echo $content; exit; }
} ?> </ul> </div> <!-- 搜索框 --> <div class="search-bar"> <form action="__APP__/search/" method="get" class="search-form"> <input type="hidden" value="mobilecontent" name="channel"> <input type="text" name="kw" class="search-txt" value=""> <i class="search-icon"></i> <input type="submit" class="search-btn" value=""> <div id="selectWrap" class="selectWrap"> <select name ="type"> <option value="" >全部</option> <?php $allCategory = CategoryNamespace::getAllCategory(true); foreach ($allCategory as $key => $value) { ?> <option <?php if ($this->category['id'] == $value['id']) { ?> selected<?php } ?> value="<?php echo $value['id']; ?> " ><?php echo $value['name']; ?> </option>
echo $v['title']; ?> " > <?php } ?> <i><?php echo $v['title']; ?> </i> </a> </div> </div> <?php } } ?> </ul> </div> <?php $this->load('Public/list/search.php', array('type_id' => $this->category['id'], 'type_name' => 'category', 'type' => CategoryNamespace::getAllCategory(true))); ?> <div class="page"> <?php echo $this->page; ?> </div> <?php $this->load('footer/footer.php'); ?> </body></html>
<?php define('CODE_BASE2', '/server/www/ganji/ganji_online/code_base2'); require_once CODE_BASE2 . '/app/category/CategoryNamespace.class.php'; //var_dump(CategoryNamespace::getAllCategory()); $cid = $_GET['category']; //$category = CategoryNamespace::getCategoryById($cid); $category = CategoryNamespace::getCategoryByScriptIndex($cid); $majorCategory = CategoryNamespace::getChildByUrl($category['source_name']); //var_dump($majorCategory); echo json_encode($majorCategory);