标签 hkcms 下的文章

找到\app\index\taglib\HkCms.php,给breadcrumb添加home字段调用

'breadcrumb'  => ['attr'=>'catid,symbol,home,class,currentstyle,isclick', 'close'=>0],

找到tagBreadcrumb函数添加home默认值;

public function tagBreadcrumb($tag)
    {
        $tag['symbol'] = $tag['symbol'] ?? ' > ';
        $tag['class']   = $tag['class'] ?? '';
        $tag['home']   = $tag['home'] ?? '首页';

找到\app\index\model\cms\Category.php里面getBreadcrumb函数调用 $tag['home'];

 public function getBreadcrumb($tag, $cate = [])
    {
        $home_url = '/';
        //$home_title = lang("Home");
        $home_title = $tag['home'];

        $catid = !empty($tag['catid']) ? $tag['catid'] : ($cate['id']??'');
        if (empty($catid)) {
            return '';
        }

模板里面使用

{hkcms:breadcrumb home="这是自定首页字符串" class="active_a" symbol=" / " /}

app/index/controller/index.php 按照以下代码修改
class Index extends BaseController

{
    protected $middleware = [ // 限制index,show方法需要登录
        \app\index\middleware\Login::class=> ['only'=>['download']]
    ];
    public function initialize()
    {
        parent::initialize();

        // 非开发者模式下,屏蔽非致命错误
        if (!$this->app->isDebug()) {
            // 屏蔽掉notice错误
            //error_reporting(E_ERROR & ~E_WARNING & ~E_NOTICE);
            error_reporting(E_ERROR);
        }

        //前台模板调用会员信息s
        $this->user = \app\index\library\User::instance();
        $user = $this->user->getUser();
        if ($user) {
            $user['group'] = $this->user->getGroups($user['id']);
        }
        $this->view->assign('user', $user);
       //前台模板调用会员信息e

    }

\vendor\topthink\framework\src\helper.php
636行
return app()->getRootPath() . 'public' . DIRECTORY_SEPARATOR . ($path ? ltrim($path, DIRECTORY_SEPARATOR) . DIRECTORY_SEPARATOR : $path);
变更为
return app()->getRootPath() . DIRECTORY_SEPARATOR . ($path ? ltrim($path, DIRECTORY_SEPARATOR) . DIRECTORY_SEPARATOR : $path);
index.php,api.php,admin.php
require __DIR__ . '/../vendor/autoload.php'; 变更为 require __DIR__ . '/vendor/autoload.php';