mirror of https://github.com/1099438829/apeblog
修正nav排序
This commit is contained in:
parent
7bb3c17598
commit
d607a4419f
|
|
@ -27,40 +27,6 @@ class Ape extends TagLib
|
|||
'nav' => ['attr' => 'type,typeId,row,void,where,orderBy,display', 'close' => 1],
|
||||
];
|
||||
|
||||
/**
|
||||
* 导航列表
|
||||
* type,栏目分类数据读取分类
|
||||
* typeId,导航列表分类,数字,字符串,或者变量
|
||||
*/
|
||||
public function tagNav($tag, $content)
|
||||
{
|
||||
$type = $tag['type'] ?? 'son';
|
||||
$typeId = $tag['typeId'] ?? '$cid';
|
||||
$row = $tag['row'] ?? 100;
|
||||
$void = $tag['void'] ?? 'field';
|
||||
$where = $tag['where'] ?? '';
|
||||
$orderBy = $tag['orderBy'] ?? 'sort asc';
|
||||
|
||||
$display = $tag['display'] ?? 1;
|
||||
$display = $display == 1 ? 1 : 0;
|
||||
//3中传参类型
|
||||
//1、栏目id,数字类型
|
||||
//2、多个栏目id,逗号隔开
|
||||
//3、变量
|
||||
//只有当多个栏目id时,才需要单引号加持。保证生成的为字符串
|
||||
if (strpos($typeId, ',')) {
|
||||
$typeId = "'$typeId'";
|
||||
}
|
||||
|
||||
$parse = '<?php ';
|
||||
$parse .= '$__LIST__ = ' . "tpl_get_nav(\"$type\",$typeId,$row,\"$where\",\"$orderBy\",$display);";
|
||||
$parse .= ' ?>';
|
||||
$parse .= '{volist name="__LIST__" id="' . $void . '"}';
|
||||
$parse .= $content;
|
||||
$parse .= '{/volist}';
|
||||
return $parse;
|
||||
}
|
||||
|
||||
/**
|
||||
* 栏目列表
|
||||
* type,栏目分类数据读取分类
|
||||
|
|
@ -372,4 +338,37 @@ class Ape extends TagLib
|
|||
return $parse;
|
||||
}
|
||||
|
||||
/**
|
||||
* 导航列表
|
||||
* type,栏目分类数据读取分类
|
||||
* typeId,导航列表分类,数字,字符串,或者变量
|
||||
*/
|
||||
public function tagNav($tag, $content)
|
||||
{
|
||||
$type = $tag['type'] ?? 'son';
|
||||
$typeId = $tag['typeId'] ?? '$cid';
|
||||
$row = $tag['row'] ?? 100;
|
||||
$void = $tag['void'] ?? 'field';
|
||||
$where = $tag['where'] ?? '';
|
||||
$orderBy = $tag['orderBy'] ?? 'sort asc';
|
||||
|
||||
$display = $tag['display'] ?? 1;
|
||||
$display = $display == 1 ? 1 : 0;
|
||||
//3中传参类型
|
||||
//1、栏目id,数字类型
|
||||
//2、多个栏目id,逗号隔开
|
||||
//3、变量
|
||||
//只有当多个栏目id时,才需要单引号加持。保证生成的为字符串
|
||||
if (strpos($typeId, ',')) {
|
||||
$typeId = "'$typeId'";
|
||||
}
|
||||
|
||||
$parse = '<?php ';
|
||||
$parse .= '$__LIST__ = ' . "tpl_get_nav(\"$type\",$typeId,$row,\"$where\",\"$orderBy\",$display);";
|
||||
$parse .= ' ?>';
|
||||
$parse .= '{volist name="__LIST__" id="' . $void . '"}';
|
||||
$parse .= $content;
|
||||
$parse .= '{/volist}';
|
||||
return $parse;
|
||||
}
|
||||
}
|
||||
|
|
@ -4,7 +4,6 @@ use app\common\constant\Data;
|
|||
use app\common\model\Comment;
|
||||
use app\common\model\Document;
|
||||
use app\common\model\DocumentCategory;
|
||||
use app\common\model\DocumentCategoryContent;
|
||||
use app\common\model\Advert;
|
||||
use app\common\model\FriendLink;
|
||||
use app\common\model\Tag;
|
||||
|
|
@ -1172,7 +1171,7 @@ function get_nav_list()
|
|||
//缓存文章菜单
|
||||
$navList = cache(Data::DATA_NAV_LIST);
|
||||
if ($navList === null) {
|
||||
$list = Nav::where('status', 1)->order('sort asc')->select()->toArray();
|
||||
$list = Nav::where('status', 1)->order('sort desc')->select()->toArray();
|
||||
//转换,让id作为数组的键
|
||||
$navList = [];
|
||||
foreach ($list as $item) {
|
||||
|
|
|
|||
|
|
@ -7,7 +7,6 @@ use app\common\constant\Data;
|
|||
use app\common\model\Comment as commentModel;
|
||||
use app\common\model\Document;
|
||||
use app\common\model\DocumentCategory;
|
||||
use app\common\model\DocumentCategoryContent;
|
||||
use app\Request;
|
||||
use think\db\exception\DataNotFoundException;
|
||||
use think\db\exception\DbException;
|
||||
|
|
|
|||
|
|
@ -6,9 +6,6 @@ use app\admin\extend\Util as Util;
|
|||
use app\common\constant\Data;
|
||||
use app\common\model\Comment as commentModel;
|
||||
use app\common\model\Document;
|
||||
use app\common\model\DocumentCategory;
|
||||
use app\common\model\DocumentCategoryContent;
|
||||
use app\common\model\Tag as TagModel;
|
||||
use app\Request;
|
||||
use think\db\exception\DataNotFoundException;
|
||||
use think\db\exception\DbException;
|
||||
|
|
|
|||
Loading…
Reference in New Issue