如标题所示
如何遍历导航栏中男生、女生下的分类?
xiaoshuo88 发表于 2022-4-7
可以调用/api/novel/category获取分类结构
结果类似这样
{
"id": 4,
"title": "男生",
"pid": 0,
"sort": 1,
"meta_title": "",
"meta_keywords": "",
"meta_description": "",
"icon": "http://site/public/home/images/default_cover.png",
"template_index": "type.html",
"template_detail": "novel.html",
"template_filter": "lists.html",
"link": "",
"create_time": 1440469030,
"update_time": 1539841781,
"status": 1,
"type": 0,
"url": "/lists/4.html",
"branch": 1,
"current": 0,
"subor": [
"id": 18,
"title": "奇幻玄幻",
"pid": 4,
"sort": 0,
"template_index": "lists.html",
"create_time": 1536657923,
"update_time": 1536657923,
"url": "/lists/18.html",
"branch": 0,
"current": 0
}...
]
}
加载数据中...
qq704401214 发表于 2022-4-7
xiaoshuo88
2022-4-7
可以用标签循环到出吗?新手不太会这个
qq704401214
xd是准备把这个分类显示在哪?
如果在模板的话在需要显示的控制器方法添加数据绑定
$category = ;//可以参考/api/novel/category 接口的写法,只获取要的字段 $this->assign('category',$category);
然后就可以在对应view的html里面用volist标签循环了
{volist name="category" id="vo"} {/volist}
xiaoshuo88
发表于 2022-4-7
可以调用/api/novel/category获取分类结构
结果类似这样
{
"id": 4,
"title": "男生",
"pid": 0,
"sort": 1,
"meta_title": "",
"meta_keywords": "",
"meta_description": "",
"icon": "http://site/public/home/images/default_cover.png",
"template_index": "type.html",
"template_detail": "novel.html",
"template_filter": "lists.html",
"link": "",
"create_time": 1440469030,
"update_time": 1539841781,
"status": 1,
"type": 0,
"url": "/lists/4.html",
"branch": 1,
"current": 0,
"subor": [
{
"id": 18,
"title": "奇幻玄幻",
"pid": 4,
"sort": 0,
"meta_title": "",
"meta_keywords": "",
"meta_description": "",
"icon": "http://site/public/home/images/default_cover.png",
"template_index": "lists.html",
"template_detail": "novel.html",
"template_filter": "lists.html",
"link": "",
"create_time": 1536657923,
"update_time": 1536657923,
"status": 1,
"type": 0,
"url": "/lists/18.html",
"branch": 0,
"current": 0
}...
]
}
评论列表
加载数据中...
qq704401214
发表于 2022-4-7
xiaoshuo88
2022-4-7
可以调用/api/novel/category获取分类结构
结果类似这样
{
"id": 4,
"title": "男生",
"pid": 0,
"sort": 1,
"meta_title": "",
"meta_keywords": "",
"meta_description": "",
"icon": "http://site/public/home/images/default_cover.png",
"template_index": "type.html",
"template_detail": "novel.html",
"template_filter": "lists.html",
"link": "",
"create_time": 1440469030,
"update_time": 1539841781,
"status": 1,
"type": 0,
"url": "/lists/4.html",
"branch": 1,
"current": 0,
"subor": [
{
"id": 18,
"title": "奇幻玄幻",
"pid": 4,
"sort": 0,
"meta_title": "",
"meta_keywords": "",
"meta_description": "",
"icon": "http://site/public/home/images/default_cover.png",
"template_index": "lists.html",
"template_detail": "novel.html",
"template_filter": "lists.html",
"link": "",
"create_time": 1536657923,
"update_time": 1536657923,
"status": 1,
"type": 0,
"url": "/lists/18.html",
"branch": 0,
"current": 0
}...
]
}
可以用标签循环到出吗?新手不太会这个
评论列表
加载数据中...
xiaoshuo88
发表于 2022-4-7
qq704401214
2022-4-7
可以用标签循环到出吗?新手不太会这个
xd是准备把这个分类显示在哪?
如果在模板的话在需要显示的控制器方法添加数据绑定
然后就可以在对应view的html里面用volist标签循环了
评论列表
加载数据中...