标签 极致cms 下的文章

<input type="text" id="keyword"><button id="so">搜索</button>
<ul id="data"></ul>
<button class="ajaxMore" style="display: none">加载更多</button>
<script type="text/javascript">
let curpage = 1;
let limit=15;
let sum =0;
let _fields='id,tid,title,keywords,description,litpic,body,htmlurl,target,addtime';
let _serUrl ="/GetData/getDataSearch.html";
let _model='article';
let _key='232323';
let _word = '';
let _title = 'title';
$("#so").click(function(){
    _word = $("#keyword").val();
    let  html='';
    $.ajax({
     url:_serUrl,
     dataType:"json",
     async:true,
     data:{model:_model,key:_key,search:_title,word:_word,fields:_fields,limit:limit,page:curpage},
     type:"POST",
     success:function(r){
         console.log(r);
            sum = r.sum;
             if(sum>=1&&sum<=limit){
                 $(".ajaxMore").show().html('没有更多了!');
            }else if(sum>limit){
                  $(".ajaxMore").show();
            }else{
                $(".ajaxMore").show().html('无相关数据');
            }
            $("#data").html('');
                for(const item of r.data){
                  html+=`<li><h4>${item.title}</h4></li>`;
                }
           $("#data").html(html);    
    },
     error:function(){

    }
    })

})
    
$(".ajaxMore").click(function(){
        curpage++;    
        let html = '';
        $.ajax({
             url:_serUrl,
             dataType:"json",
             async:true,
             data:{model:_model,key:_key,search:_title,word:_word,fields:_fields,limit:limit,page:curpage},
             type:"POST",
             success:function(r){
                 if(r.data.length>0){
                     let allpage = r.allpage;
                    if(curpage<=allpage){
                        if(r.data.length<limit){
                           $(".ajaxMore").text('没有更多了!');
                         };
                        for(const item of r.data){
                              html+=`<li><h4>${item.title}</h4></li>`
                         }
                        $("#data").append(html);
                         

                       }
               }

             }
        })


})


</script>

后台内容列表展示字段样式定义在conf/Functions.php下面format_fields()函数里面

站点关闭模板路径在app\home\c\CommonController.php下面close()函数里面

站点验证码函数定义在\frphp\extend\Vercode.php下面Imagecode里

站点前台验证码函数app\home\c\CommonController.php下面vercode()函数里面

站点后台验证码函数\app\admin\c\LoginController.php下面vercode()函数里面

后台删除缩略图js函数deleteImage_auto()定义在\app\admin\t\tpl\common\fields.html文件

系统提示函数修改frphp\common\Functions.php

伪静态禁止某文件夹执行某种文件
apache:
RewriteRule (uploads|static/upload)/(.*).(php)$ – [F]
RewriteRule (static/template)/(.*).(html)$ – [F]
nginx:
location ~* ^/(uploads|static/upload)/.*.(php|php5)$ {
        deny all; 
}
location ~* ^/(static/template)/.*.(html)$ {
        deny all; 
}

极致cms系统定义信息提示方法使用的的alert(),缺少一些美感,该方法定义在\frphp\common\Functions.php里面function Success()和function Error()两个函数里面,找到方法引入layer.js,使用layer.msg(),代替alert(),可以简单修改弹出信息的样式,也可以自定义复杂的方法

找到conf/FunctionsExt.php。添加如下函数
function lazyImg($richText) {
    return preg_replace_callback(
        '/<img\s+([^>]*)\s*>/i',
        function ($matches) {
            $attributes = $matches[1];
            $newAttributes = str_replace('src=', 'data-src=', $attributes);
            return str_replace($attributes, $newAttributes, $matches[0]);
        },
        $richText
    );
}
找到/app/home/c/HomeController.php
找到 function jizhi_details($id){}函数里面
把$con = $details['body'];
改成$con = lazyImg($details['body']);
前端引入懒加载插件,即可完成

极致cms多行文本字段,编辑框给换行,如果想前台输出换行,官方文档给出了函数,
{fun nl2br($jz['字段名称'])};
如果想输出的内容外围添加标签,使用foreach循环输出,如下:
{foreach explode("\n",$jz['字段名称']) as $v}
{if($v)}
<p>{$v}</p>
{/if}
{/foreach}