J5增加tag標(biāo)簽自定義URL
1、index.php文件detail節(jié)點
$rsTag = strval($rs -> tag);//增加tag
模塊管理-添加字段tag,16標(biāo)簽輸入框。
2、tag/礦山副井井筒裝備安裝/
http://www.tkrockdrill.com/tag/%E7%9F%BF%E5%B1%B1%E5%89%AF%E4%BA%95%E4%BA%95%E7%AD%92%E8%A3%85%E5%A4%87%E5%AE%89%E8%A3%85/product/
自定義URL
$slug = strval($req -> get('slug'));
manage.php文件
add節(jié)點加上
$schemaGenerator -> extra -> tag = ['api' => 'universal/tag/manageApi?type=list&genre=' . urlencode($genre)];
$schemaGenerator -> tips -> slug = Jtbc::take('manage.text-tips-field-slug', 'lng');
edit節(jié)點加上
搜索$data = $rs -> toArray();下面加以下代碼
$genre = $this -> getParam('genre');
$lang = $this -> guard -> role -> getLang();
$category = new Category($genre, $lang);
搜索if (!$this -> guard -> role -> checkPermission('publish'))上面加以下代碼
$schemaGenerator -> extra -> tag = ['api' => 'universal/tag/manageApi?type=list&genre=' . urlencode($genre)];
$schemaGenerator -> tips -> slug = Jtbc::take('manage.text-tips-field-slug', 'lng');
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~···
新聞模塊增加tag標(biāo)簽文章列表
找到public function list(Request $req, Response $res)節(jié)點
1、搜索$page = intval($req -> get('page'));在上面增加以下代碼
$tag = strval($req -> get('tag'));//tag增加
$keyword = strval($req -> get('keyword'));//tag增加
2、搜索$model -> orderBy('time', 'desc');在上面增加以下代碼
if (!Validation::isEmpty($tag))//tag增加開始
{
$model -> where -> tag -> like('%"' . $tag . '"%');
}
if (!Validation::isEmpty($keyword))
{
$model -> where(function($where) use ($keyword){
$where -> title -> like('%' . $keyword . '%');
$where -> summary -> or -> like('%' . $keyword . '%');
});
}//tag增加結(jié)束
tag前端鏈接/blog/?type=list&tag=網(wǎng)站設(shè)計
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~···
文章所屬tag
{$=$render('global.render.blog-tags', $convertToOption($jsonDecode(#tag) ?? []))}
節(jié)點 [ blog-tags ]代碼
<a href="{$=$getActualRoute('blog')}/?type=list&tag={$=urlencode(#text)}">{$text}</a>
右側(cè)調(diào)用tag列表
{$=$render('global.render.sidebar-tags', $fetch(['genre' => 'universal/tag', 'where' => ['genre' => 'blog'], 'orderBy' => [['associated_count', 'desc']], 'limit' => 50]))}
節(jié)點 [ sidebar-tags ]代碼
<section>
<h3>{$=$take('global.communal.sidebar-tags', 'lng')}</h3>
<div class="tags">{@}<a href="{$=$getActualRoute('blog')}/?type=list&tag={$=urlencode(#tag)}">{$tag}</a>{@}</div>
</section>