感謝Mr.Dou快速的回答上一條問題;
在文章分類里面,
例如:
公司新聞是一條新聞一行的
行業新聞是兩條新聞一行兩列的。
請問怎樣才可以做到像自定義單頁面一樣可以自定義分類頁面呢?
把自定義單頁面的代碼改成這樣了,但是不能實現,
if (file_exists(ROOT_PATH . "theme/$_CFG[site_theme]/" . $article_category['unique_id'] . '.dwt')) {
$smarty->display($article_category['unique_id'] . '.dwt');
} else {
$smarty->display('article_category.dwt');
}
由DouPHP官方技術于2019-08-22 04:44回答
文章分類頁自定義,可以這樣,可以使用文章分類別名作為標記,比如
// 獲取文章分類別名
$unique_id = $dou->get_one("SELECT unique_id FROM " . $dou->table('article_category') . " WHERE cat_id = '$cat_id'");
if (file_exists(ROOT_PATH . "theme/$_CFG[site_theme]/" . 'article_category_' . $unique_id . '.dwt')) {
$smarty->display('article_category_' . $unique_id . '.dwt');
} else {
$smarty->display('article_category.dwt');
}
// 獲取文章分類別名
$unique_id = $dou->get_one("SELECT unique_id FROM " . $dou->table('article_category') . " WHERE cat_id = '$cat_id'");
if (file_exists(ROOT_PATH . "theme/$_CFG[site_theme]/" . 'article_category_' . $unique_id . '.dwt')) {
$smarty->display('article_category_' . $unique_id . '.dwt');
} else {
$smarty->display('article_category.dwt');
}
有用(1) 沒用(0)