Esempio n. 1
0
<?php

include 'init.php';
include SROOT . 'categoryService.class.php';
$service = new CategoryService();
$result = $service->getAll();
if ($result) {
    $data = array('result' => $result);
    render('category.list', $data);
} else {
    render('category.list');
}
Esempio n. 2
0
                 // 静态化文章,及更新列表
                 $service->staticArticle($id);
                 $category = $categoryService->findById(v('cid'));
                 $service->staticArticleList($category);
                 $service->staticIndex();
             }
         }
         forward('article_list.php?status=0');
     } else {
         send_result(0, 'request does not have title,abstract,content,id,cid parames');
     }
 } else {
     if ($method == 'edit') {
         if (v('id')) {
             $article = $service->findById(v('id'));
             $result = $categoryService->getAll();
             $data = array('category_data' => $result);
             if ($article) {
                 // 避免pre中的<>字符与编辑器冲突
                 $article['content'] = str_replace('&gt;', '&amp;gt;', $article['content']);
                 $article['content'] = str_replace('&lt;', '&amp;lt;', $article['content']);
                 $data['article'] = $article;
             }
             render('article.edit', $data);
         } else {
             $result = $categoryService->getAll();
             $data = array('category_data' => $result);
             render('article.edit', $data);
         }
     } else {
         if ($method == 'publish') {
Esempio n. 3
0
<?php

include '../init.php';
require_once SROOT . 'articleService.class.php';
require_once SROOT . 'categoryService.class.php';
$as = new ArticleService();
$as->staticIndex();
$cs = new CategoryService();
$cs->staticCategoryJs();
$cList = $cs->getAll();
foreach ($cList as $row) {
    $as->staticArticleList($row);
}
$aList = $as->getAll(1);
foreach ($aList as $row) {
    $as->staticArticle($row['id']);
}