eyoucms伪静态URL添加详情页自定义文件名

admin3年前eyoucms649

application/helper.php

474

$vars = array(
                    'aid'   => $param['aid'],
                    'dirname'   => $param['dirname'],
                );

替换为

$vars = array(
                    'aid'   => !empty($param['htmlfilename'])?$param['htmlfilename']:$param['aid'],
                    'dirname'   => $param['dirname']
                );


application/home/controller/View.php

function index函数

if (!is_numeric($aid) || strval(intval($aid)) !== strval($aid)) {
            abort(404,'页面不存在');
        }

替换为

if (empty($aid)) {
            abort(404,'页面不存在');
        }


$aid = intval($aid);
        $archivesInfo = M('archives')->field('a.typeid, a.channel, b.nid, b.ctl_name')
            ->alias('a')
            ->join('__CHANNELTYPE__ b', 'a.channel = b.id', 'LEFT')
            ->where([
                'a.aid'     => $aid,
                'a.is_del'      => 0,
            ])
            ->find();
        if (empty($archivesInfo) || !in_array($archivesInfo['channel'], config('global.allow_release_channel'))) {
            abort(404,'页面不存在');
            // $this->redirect('/public/static/errpage/404.html', 301);
        }

替换为

if(!empty(intval($aid))) {
            $aid = intval($aid);
            $archivesInfo = M('archives')->field('a.typeid, a.channel, b.nid, b.ctl_name')
            ->alias('a')
            ->join('__CHANNELTYPE__ b', 'a.channel = b.id', 'LEFT')
            ->where([
                'a.aid'     => $aid,
                'a.is_del'      => 0,
            ])
            ->find();
            if (empty($archivesInfo) || !in_array($archivesInfo['channel'], config('global.allow_release_channel'))) {
                abort(404,'页面不存在');
            }
        }else {
            $archivesInfo = M('archives')->field('a.aid, a.typeid, a.channel, b.nid, b.ctl_name')
            ->alias('a')
            ->join('__CHANNELTYPE__ b', 'a.channel = b.id', 'LEFT')
            ->where([
                'a.htmlfilename'     => $aid,
                'a.is_del'      => 0,
            ])
            ->find();
            if (empty($archivesInfo) || !in_array($archivesInfo['channel'], config('global.allow_release_channel'))) {
                abort(404,'页面不存在');
            }
            $aid = intval($archivesInfo['aid']);
        }

core/library/think/template/taglib/eyou/TagType.php

$aid = I('param.aid/d', 0);
        if ($aid > 0) {
            $this->tid = M('archives')->where('aid', $aid)->getField('typeid');
        }

替换为

$aid = I('param.aid/s', '');
        if (!empty(intval($aid))) {
            $this->tid = M('archives')->where('aid', $aid)->getField('typeid');
        }else {
           
if(!empty($aid))
$this->tid = M('archives')->where('htmlfilename', $aid)->getField('typeid');
        }

core/library/think/template/taglib/eyou/TagPosition.php

core/library/think/template/taglib/eyou/TagList.php

如上操作


core/library/think/template/taglib/eyou/TagChanner.php

$aid = I('param.aid/d', 0);

替换为

$aid = I('param.aid/s', '');


$this->tid = M('archives')->where('aid', $aid)->getField('typeid');

替换为

if (!empty(intval($aid))) {
                    $this->tid = M('archives')->where('aid', $aid)->getField('typeid');
                }else {
                    if(!empty($aid)) $this->tid = M('archives')->where('htmlfilename', $aid)->getField('typeid');
                }


相关文章

layui+eyou生成多个二维码

layui+eyou生成多个二维码...

eyoucms配置多级子目录伪静态,譬如/a/b/

application/helper.php359行'tid'   => substr($param['diy_dirpath'], 1),390行&n...

留言样式

留言样式

{eyou:guestbookform typeid='18'}    {eyou:static file="/public/static/common/...

eyoucms修复文章内页 上一条下一条BUG

<?php/** * 易优CMS * ====================================================================...

织梦,dedecms,导入到EYOU

<?phpheader("Content-type:text/html;charset=utf-8");$con = mysqli_connect("localho...

发表评论    

◎欢迎参与讨论,请在这里发表您的看法、交流您的观点。