克隆/下载
贡献代码
同步代码
取消
提示: 由于 Git 不支持空文件夾,创建文件夹后会生成空的 .keep 文件
Loading...
README
Apache-2.0

该CMS是一款基于FastAdmin框架(version:1.5.0.20240328)开发的,FastAdmin基于ThinkPHP5+Bootstrap开发的框架。

界面截图

超级管理员才有的设置

环境要求

操作系统:Linux、Windows、Mac OS
Web 服务器:Apache、Nginx
PHP 版本:>= 7.2 且 <= 7.4 (推荐 PHP7.4 版本)
MySQL 版本:>= 5.6 且 <= 8.0 (需支持 innodb 引擎)

下载方法

下载默认直接:
`git clone https://gitee.com/xiaohe4966/cms.git`

下载某个分支:
`git clone -b 分支名 https://gitee.com/xiaohe4966/cms.git`

安装方法

修改网站运行目录为public
修改伪静态!!!修改伪静态!!修改伪静态!
正常Nginx伪静态
```
location ~* (runtime|application)/{
    return 403;
}
location / {
    if (!-e $request_filename){
        rewrite  ^(.*)$  /index.php?s=$1  last;   break;
    }
}
```

        

文件在application/database.php里面修改   //或者在根目录.env里面更改(没有此文件请忽略)

然后安装即可  
      
安装完成,就可以访问了后台地址 域名/h.php
后台地址在public/h.php 可以自行修改文件名即可    
cms首页: 打开域名会跳转到/cms/index/index,如果不需要可以自行注释跳转 application/index/controller/Index.php

使用流程

安装好框架后
只需要复制表修改表字段(只需要字段)
一键生成后台菜单命令(增删改查)
添加/修改栏目选择表即可(如果数据库表名未修改不用修改)

注意事项及说明

  • 数据库设计要求
  • 数据库说明
    • xx代表表前缀
    • xx_cate CMS栏目的栏目,不能删除(可以添加其他通用字段
    • xx_page CMS的单页内容信息,不能删除(可以添加其他通用字段
    • xx_user 在原Fastadmin的user表
    • xx_admin 登陆后台的账号
    • xx_command Fastadmin的一键命令插件记录
    • xx_config 网站常规配置就在这里面,在后台可直接添加
    • xx_news 列表页的内容,通用都可以复制此表改名改备注即可(列表页面的 deletetime 字段不要删除,用户在后台删除后,可以进入回收站,但前台会看不见,以防误操作)

在线演示

http://cms.he4966.cn/cms/index/index

配置

微信配置在  后台常规管理->系统配置->微信->设置小程序公众号等资料

设置图

调试模式开启application/config.php  
// 应用调试模式
'app_debug' => Env::get('app.debug', 1),    //或者在根目录.env里面更改(没有此文件请忽略)

数据库配置修改application/database.php里面修改   //或者在根目录.env里面更改(没有此文件请忽略)

使用标签

thinkphp5.0 手册(https://www.kancloud.cn/manual/thinkphp5/125005)

后台参数标签

    {$site.后台添加的字段}
    <!-- 示例 -->
    {$site.name} //网站名称
    {$site.keywords} //网站关键字
    {$site.description} //网站描述
    {$site.beian} //网站备案号
    {$site.logo} //网站logo
    ...可以自己添加

获取config.php里面的配置

    {$Think.config.fastadmin.version}

获取栏目名

    {tp:cate id="38" type="name"}

获取栏目地址链接

    {tp:cate id="38" type="url"}
//这个url在application/common.php  getCateUrl方法里面(可自行修改封装

获取栏目某个字段

    {tp:cate id="38" type="字段"} 

获取栏目里面的 列表数据

    <!-- 循环的导航栏 某个栏目id里面新闻或者自己添加的栏目里面的列表 -->
    {volist name="nav" id="v"}
    {if $v.id==67}
        {volist name="$v.childlist" id="v2"}
        
        <div class="product_con">
            <div class="pro_tit">
            <img src="__CMS__/images/he4966.png" alt="">{$v2.name}
            </div>
        <ul>
            <!-- 因为列表里面是含有子栏目的列表 所以要判断if 如果要包含子栏目的数据可以取消判断if-->
            {tp:list name="p" id="$v2['id']">}
            {if $v2.id==$p.cate_id}
            <li><a href="{$p.url}">{$p.title}</a></li>
            {/if}
            {/tp:list}
        </ul>

        </div>
        {/volist}
    {/if}
    {/volist}

🗂️获取列表

参数:id(栏目id),name(变量名 默认$list),pagesize(一页数量),where(条件),limit(每页数量 默认0),order(排序 默认'weigh DESC,id DESC')
    <!--id是栏目ID 取这栏目标里面数据库的数据   如果要具体某个栏目下面的数据(前提是这个栏目是栏目的N个子栏目) 可以加where="cate_id=68"-->
    {tp:list name="list" id="1" limit="3"}
        //{$list.这个栏目表里面的字段}
        {$list.title}
        {$list.image}
        {$list.url}//这个url在application/common.php 里面的getShowUrl方法里面(可自行修改封装
    {/tp:list}
    🌹只能在列表页面使用 列表页字带list变量
    {volist name="list" id="v"}
    <a href="{$v.url}">{$v.title}</a>
    {/volist}

🗂️获取列表加条件 where里面是条件

    <!-- 推荐条件写法 -->
    {tp:list id="61" limit="2" name="v" where="FIND_IN_SET('1', hotdata)"}
    <div class="news-tu">

        <a href="{$v.url}">
        <b class="dot">{$v.title}</b>
        <i>{:date('Y-m-d',$v.createtime)}</i>
        <p> {$v.description}</p>
        <img src="{$v.image?$v.image:'__CMS__/images/news.jpg'}">
        </a>
    </div>
    {/tp:list}

🗂️获取列表加条件 FIND_IN_SET多个

    <!-- 多个推荐条件写法  推荐里面包含1或2的列表 推荐:1=推荐,2=特荐,3=头条,4=精华-->
    {tp:list id="61" limit="2" name="v" where="FIND_IN_SET('1', hotdata) OR FIND_IN_SET('2', hotdata)"}
    {/tp:list}

🗂️获取新增列表数据示例

    <!-- 比如我在fa_news表复制一份表名为fa_pro加入了其他字段 然后我要获取这个列表的数据 -->
    <!-- 和上面一样 栏目里面含有这个表名 只需要填写对应栏目id即可 -->
    {tp:list name="v" id="67" limit="10"  where="FIND_IN_SET('1', hotdata) AND cate_id=68"}
        <!-- 循环你的数据 -->
        <a href="{$v.url}">{$v.title}</a>
    {/tp:list}

循环多级栏目 及 当前栏目高亮

    {volist name="nav" id="v"}                            
        {if $v.childlist}
        <li class="dropdown {if $cate['id'] eq $v['id']  OR $cate['is_top'] eq $v['id']}current{/if}   "><a href="{$v.url}">{$v.name}</a>                                
            <ul>
                {volist name="$v.childlist" id="v2"}                                       
                
                    {if $v2.childlist}                                            
                        <li class="dropdown"><a href="{$v2.url}">{$v2.name}</a>
                            <ul>
                                {volist name="$v2.childlist" id="v3"}
                                <li><a href="{$v3.url}">{$v3.name}</a></li>
                                {/volist}                                
                            </ul>
                        </li>
                    {else /}
                    
                        <li><a href="{$v2.url}">{$v2.name}</a></li>
                    {/if}
                {/volist}
            </ul>
        </li>   
        {else /}
            <li {if $cate['id'] eq $v['id']}class="current"{/if}><a href="{$v.url}">{$v.name}</a></li>
        {/if}
    {/volist}
这段代码通过循环遍历和条件判断,动态生成了多级导航菜单。使用了volist标签来循环遍历导航数据。其中name="nav"表示遍历的变量名为nav(导航栏目),id="v"表示将遍历的每个元素赋值给变量v。

                                                   
在遍历过程中,使用if标签判断当前导航是否有子菜单(childlist),如果有,则将其渲染为下拉菜单。下拉菜单中同样使用了volist标签来遍历子菜单数据。子菜单同样存在是否有子菜单的情况,通过嵌套使用volist标签来实现。

如果导航没有子菜单,则直接渲染为一个普通的导航项。在导航项中,通过if标签判断当前导航项是否为当前选中状态,如果是,则添加class="current"。

列表页分页示例

上一页

    {if $page_data['prev_page']}<li><a href="{$page_data.prev_page.url}"><span class="fa fa-angle-left"></span></a></li>{/if}

循环中间页码并高量当前页

    {volist name="$page_data['list']" id="v"}
    <li><a href="{$v.url}" {if $page_data['page'] eq $v['num']}class="active"{/if}>{$v.num}</a></li>
    {/volist}

下一页

    {if $page_data['next_page']}<li><a href="{$page_data.next_page.url}"><span class="fa fa-angle-right"></span></a></li>{/if}

详情页面

上一篇:

    {if $content.prev}<ul class="fot_prv com_url" data-url="{$content.prev.url}">上一篇:{$content.prev.title}</ul>{/if}

下一篇:

    {if $content.next}<ul class="fot_next com_url" data-url="{$content.next.url}">下一篇:{$content.next.title}</ul>{/if}

非单页面获取单页数据:

    <!-- 注意52是单页 栏目id  type为字段-->
    {tp:page id="52" type="content"}

不放a标签点击跳转页面(确定✅页面里有引用过jquery)

    <script>
        $('.com_url').on('click',function(e){
            var url = $(this).attr('data-url');
            location.href = url;
        });
    </script>

友情链接

        <!-- 友情链接1 -->
        {tp:link  limit="20"}
            <li><a href="{$link.url}">{$key+1}.{$link.title}</a></li>
        {/tp:link}

        <!-- 友情链接2 -->
        {tp:link  name="v"}
            <li><a href="{$v.url}">{$v.title}</a></li>
        {/tp:link}

        <!-- 友情链接3 -->
        <ul class="list">
            {tp:link  limit="20" }
            <li><a href="{$link.url}" onclick="sendLinkClickRequestAndOpenLink(event, {$link.id}); return false;">{$key+1}.{$link.title}</a></li>
            {/tp:link}
        </ul>

        <script>
            // 这个函数会在用户点击链接时被调用
            function sendLinkClickRequestAndOpenLink(event, id) {
                // 发送请求到服务器
                fetch('/api/cms/link_click?id='+id)
                    .then(response => {
                        // 检查请求是否成功
                        if (response.ok) {
                            // console.log('请求发送成功');
                        } else {
                            // console.error('请求发送失败');
                        }
                    })
                    .catch(error => {
                        // 处理网络错误
                        // console.error('网络错误:', error);
                    });
                // 打开链接在新窗口
                window.open(event.target.href, '_blank');
            }
        </script>

其他说明

    留言地址: /cms/gbook/add 前段页面form表单提交地址可以返回

    <!-- text验证码示例 建议判断加上-->
    {if $site.gbook_captcha_switch}
    <div class="col-md-6 col-sm-6 col-xs-12 form-group">
        <input type="text" name="captcha" placeholder="请输验证码" required>
    </div>
    <div class="col-md-6 col-sm-6 col-xs-12 form-group">
        <img src="{:captcha_src()}" style="height: 100%;" onclick="this.src = '{:captcha_src()}?r=' + Math.random();"/>
    </div>
    {/if}


    获取当前位置信息
    <!-- cate_id 注意栏目页是$cate  详情页是$content-->
    <span class="inposition">当前位置:</span><a href="/">首页</a>
    {tp:position name="v" cate_id="$cate['id']"}
    &gt; <a class="navover" href="{$v.url}"> {$v.name}</a>
    {/tp:position}

    🌹除了首页都有$cate变量(可直接使用)
    🌹详情页和单页有$content变量(可直接使用)
    🌹搜索地址:/路由?search=搜索的内容 自动搜索该栏目下的内容
      示例/news?search=小和
      搜索代码application/cms/controller/Cms.php get_cate_art_list2方法
        if(isset($params['search']) && !empty($params['search'])){
            $where['title|content|seotitle|keywords|description|memo'] = ['like',"%".$params['search']."%"];
            unset($where['cate_id']);//如果搜索当前栏目下的列表就注释该代码
        }

    data-area='["80%", "80%"]' 按钮弹窗大小定义
    示例
    <a href="javascript:;" class="btn btn-success btn-add  title="{:__('Add')}" data-area='["80%", "80%"]' ><i class="fa fa-plus"></i> {:__('Add')}</a>
    自己添加定时检查链接是否有效
    域名+/api/cms/link_check 检测链接是否有效

版本更新日志

2024-03-01 开始立项
2024-05-13 继续开始开发
2024-05-16 完成基本功能
2024-05-17 添加违禁词验证(后台内容可强制添加/编辑 有设置开关,函数bans(违禁词)返回包含的违禁词) 
2024-05-22 添加后台超级管理员配置 可隐藏非超级管理员的组或者某个配置字段
2024-05-30 添加后台配置字段crud_copy_switch 可在线命令生成 复制数据按钮
2024-11-28 添加批量移动/复制/编辑字段,根据表含有cate_id自动生成 (方法在👉🏻app\common\controller\Backend)
2024-11-29 添加前台网站生成sitemap功能 /api/cms/update_sitemap

代码说明

文件说明

  • 标签文件定义 application/common/library/Tp.php

  • 方法定义 application/common.php

  • 栏目选择 把空格实体替换成空字符 text = text.replace(/ /g," "); 文件路径 public/assets/libs/fastadmin-selectpage/selectpage.js

问题反馈

在使用中有任何问题,请加QQ群153073132 请备注CMS

特别鸣谢

FastAdmin

版权信息

CMS遵循Apache2开源协议发布,并提供免费使用。 本项目包含的第三方源码和二进制文件之版权信息另行标注。

Apache License Version 2.0, January 2004 http://www.apache.org/licenses/ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 1. Definitions. "License" shall mean the terms and conditions for use, reproduction, and distribution as defined by Sections 1 through 9 of this document. "Licensor" shall mean the copyright owner or entity authorized by the copyright owner that is granting the License. "Legal Entity" shall mean the union of the acting entity and all other entities that control, are controlled by, or are under common control with that entity. For the purposes of this definition, "control" means (i) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the outstanding shares, or (iii) beneficial ownership of such entity. "You" (or "Your") shall mean an individual or Legal Entity exercising permissions granted by this License. "Source" form shall mean the preferred form for making modifications, including but not limited to software source code, documentation source, and configuration files. "Object" form shall mean any form resulting from mechanical transformation or translation of a Source form, including but not limited to compiled object code, generated documentation, and conversions to other media types. "Work" shall mean the work of authorship, whether in Source or Object form, made available under the License, as indicated by a copyright notice that is included in or attached to the work (an example is provided in the Appendix below). "Derivative Works" shall mean any work, whether in Source or Object form, that is based on (or derived from) the Work and for which the editorial revisions, annotations, elaborations, or other modifications represent, as a whole, an original work of authorship. For the purposes of this License, Derivative Works shall not include works that remain separable from, or merely link (or bind by name) to the interfaces of, the Work and Derivative Works thereof. "Contribution" shall mean any work of authorship, including the original version of the Work and any modifications or additions to that Work or Derivative Works thereof, that is intentionally submitted to Licensor for inclusion in the Work by the copyright owner or by an individual or Legal Entity authorized to submit on behalf of the copyright owner. For the purposes of this definition, "submitted" means any form of electronic, verbal, or written communication sent to the Licensor or its representatives, including but not limited to communication on electronic mailing lists, source code control systems, and issue tracking systems that are managed by, or on behalf of, the Licensor for the purpose of discussing and improving the Work, but excluding communication that is conspicuously marked or otherwise designated in writing by the copyright owner as "Not a Contribution." "Contributor" shall mean Licensor and any individual or Legal Entity on behalf of whom a Contribution has been received by Licensor and subsequently incorporated within the Work. 2. Grant of Copyright License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable copyright license to reproduce, prepare Derivative Works of, publicly display, publicly perform, sublicense, and distribute the Work and such Derivative Works in Source or Object form. 3. Grant of Patent License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable (except as stated in this section) patent license to make, have made, use, offer to sell, sell, import, and otherwise transfer the Work, where such license applies only to those patent claims licensable by such Contributor that are necessarily infringed by their Contribution(s) alone or by combination of their Contribution(s) with the Work to which such Contribution(s) was submitted. If You institute patent litigation against any entity (including a cross-claim or counterclaim in a lawsuit) alleging that the Work or a Contribution incorporated within the Work constitutes direct or contributory patent infringement, then any patent licenses granted to You under this License for that Work shall terminate as of the date such litigation is filed. 4. Redistribution. You may reproduce and distribute copies of the Work or Derivative Works thereof in any medium, with or without modifications, and in Source or Object form, provided that You meet the following conditions: You must give any other recipients of the Work or Derivative Works a copy of this License; and You must cause any modified files to carry prominent notices stating that You changed the files; and You must retain, in the Source form of any Derivative Works that You distribute, all copyright, patent, trademark, and attribution notices from the Source form of the Work, excluding those notices that do not pertain to any part of the Derivative Works; and If the Work includes a "NOTICE" text file as part of its distribution, then any Derivative Works that You distribute must include a readable copy of the attribution notices contained within such NOTICE file, excluding those notices that do not pertain to any part of the Derivative Works, in at least one of the following places: within a NOTICE text file distributed as part of the Derivative Works; within the Source form or documentation, if provided along with the Derivative Works; or, within a display generated by the Derivative Works, if and wherever such third-party notices normally appear. The contents of the NOTICE file are for informational purposes only and do not modify the License. You may add Your own attribution notices within Derivative Works that You distribute, alongside or as an addendum to the NOTICE text from the Work, provided that such additional attribution notices cannot be construed as modifying the License. You may add Your own copyright statement to Your modifications and may provide additional or different license terms and conditions for use, reproduction, or distribution of Your modifications, or for any such Derivative Works as a whole, provided Your use, reproduction, and distribution of the Work otherwise complies with the conditions stated in this License. 5. Submission of Contributions. Unless You explicitly state otherwise, any Contribution intentionally submitted for inclusion in the Work by You to the Licensor shall be under the terms and conditions of this License, without any additional terms or conditions. Notwithstanding the above, nothing herein shall supersede or modify the terms of any separate license agreement you may have executed with Licensor regarding such Contributions. 6. Trademarks. This License does not grant permission to use the trade names, trademarks, service marks, or product names of the Licensor, except as required for reasonable and customary use in describing the origin of the Work and reproducing the content of the NOTICE file. 7. Disclaimer of Warranty. Unless required by applicable law or agreed to in writing, Licensor provides the Work (and each Contributor provides its Contributions) on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, including, without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are solely responsible for determining the appropriateness of using or redistributing the Work and assume any risks associated with Your exercise of permissions under this License. 8. Limitation of Liability. In no event and under no legal theory, whether in tort (including negligence), contract, or otherwise, unless required by applicable law (such as deliberate and grossly negligent acts) or agreed to in writing, shall any Contributor be liable to You for damages, including any direct, indirect, special, incidental, or consequential damages of any character arising as a result of this License or out of the use or inability to use the Work (including but not limited to damages for loss of goodwill, work stoppage, computer failure or malfunction, or any and all other commercial damages or losses), even if such Contributor has been advised of the possibility of such damages. 9. Accepting Warranty or Additional Liability. While redistributing the Work or Derivative Works thereof, You may choose to offer, and charge a fee for, acceptance of support, warranty, indemnity, or other liability obligations and/or rights consistent with this License. However, in accepting such obligations, You may act only on Your own behalf and on Your sole responsibility, not on behalf of any other Contributor, and only if You agree to indemnify, defend, and hold each Contributor harmless for any liability incurred by, or claims asserted against, such Contributor by reason of your accepting any such warranty or additional liability. END OF TERMS AND CONDITIONS APPENDIX: How to apply the Apache License to your work To apply the Apache License to your work, attach the following boilerplate notice, with the fields enclosed by brackets "{}" replaced with your own identifying information. (Don't include the brackets!) The text should be enclosed in the appropriate comment syntax for the file format. We also recommend that a file or class name and description of purpose be included on the same "printed page" as the copyright notice for easier identification within third-party archives. Copyright 2017 Karson Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

简介

该项目是TpMeCMS升级版本更好的CMS 展开 收起
JavaScript 等 6 种语言
Apache-2.0
取消

发行版 (3)

全部
5个月前

贡献者

全部

近期动态

不能加载更多了
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化