search
HomeBackend DevelopmentPHP Tutorial自各儿积累phpCMS 二次开发(二)

自己积累phpCMS 二次开发(二)
1.自己修改phpcms后台点击修改/添加内容,在浏览器的新窗口中打开。


   一、打开\phpcms\modules\content\templates  下的content_list.tpl.php文件
   二、找到添加内容      修改内容
   三、
   添加:

target="_blank">

   
   修改:

['pc_hash'];?>" target="_blank">


2.修改网站后台登陆页面,和后台首页信息!


    第一是标题:一个是admin_site_title、website_manage,这是后台管理标题参数,还有一个后台登录的标题参数,phpcms_logon。
               分别在/phpcms/languages/zh-cn/admin.lang.php的第9行、第668行,/phpcms/languages/zh-cn/system.lang.php的第9行。
               其他的参数也都可以看着修改,还有个copyright参数,可以改下,后台登录的的底部信息。
    第二是登录成功后首页:首页的展示信息,模板在/phpcms/modules/admin/templates/main.tpl.php,后台首页自定义添加修改。
    第三是后台的logo图片,样式文件在/statics/css/zh-cn-system.css,第37行.header .logo。
    基本上后台就这些需要改的,后台需要改的页面模板基本都在/phpcms/modules的几个文件夹。


3.除某一两个栏目外循环出所有的栏目。
  例:   
       {loop subcat(9,0,0,$siteid) $r}
{if $r['catid']==10 }{/if}
{if $r['catid']==11 }{/if}
   

  • {$r[catname]}

  •    


    •    {loop subcat($r[catid],0,0,$siteid) $w}
    • {$w[catname]}

    •    {/loop}

         

  • {/loop}


    4.phpCMS格式化时间的多种方式。
    a\标准型:{date('Y-m-d H:i:s', $rs['inputtime'])}  输出为:2010-12-31 13:15:10
    b\拆分型:{date('Y',$rs[inputtime])}年{date('m',$rs[inputtime])}月{date('d',$rs[inputtime])}日  输出为:2010年12月31日
    c\扩展型:
    {date('Y',$inputtime);} 4位年份  输出为:2010 或 2011
    {date('y',$inputtime);} 2位年份  输出为:10 或 11
    {date('F',$inputtime);} 英文月份全称  输出为:January 到 December
    {date('M',$inputtime); } 英文月份缩写  输出为:Jan 到 Dec
    {date('m',$inputtime);} 前导零数字月份  输出为:01 到 12
    {date('n',$inputtime); } 数字月份  输出为:1 到 12
    {date('d',$inputtime);} 前导零日期  输出为:01 到 31
    {date('j',$inputtime);} 日期  输出为:1 到 31
    {date('l',$inputtime);} 英文星期全称  输出为:Sunday 到 Saturday
    {date('D',$inputtime);} 英文星期缩写  输出为:Mon 到 Sun
    {date('N',$inputtime);} 格式数字星期  输出为:1 到 7


    5..phpcms V9编辑器的批量去除超链接功能
    1、批量去除超链接:
    打开 statics/js/ckeditor/ckeditor.js
    找到
    $.execCommand('unlink',false,null);
    修改为:
    $.execCommand('unlink',false,true);
    2、上传图片自动添加ALT参数
    修改 statics/js/ckeditor/plugins/image/dialogs/image.js
    找到
    accessKey:'T','default':''
    替换成
    accessKey:'T','default':$('#title').val()
    3、修改编辑器回车换行

    or

    打开文件 \statics\js\ckeditor\config.js 把里面的
    config.enterMode = CKEDITOR.ENTER_BR;
    config.shiftEnterMode = CKEDITOR.ENTER_P;
    修改为
    config.enterMode = CKEDITOR.ENTER_P;
    config.shiftEnterMode = CKEDITOR.ENTER_BR;
    4、给编辑器添加一键排版功能
    修改
    phpcms\libs\classes栏目下的
    form.class.php找到['Maximize'], 在它下面添加['autoformat'],保存即可。
    找到statics\js\ckeditor文件夹下的config.js 文件
    找到
    config.extraPlugins = 'capture';
    修改为:
    config.extraPlugins = 'capture,autoformat';
    保存即可。
    修改后记得更新缓存,清除cookies。


    6.显示指定id的栏目名称 (例子这里catid=22){$CATEGORYS[22]['catname']}

    Statement
    The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
    PHP Performance Tuning for High Traffic WebsitesPHP Performance Tuning for High Traffic WebsitesMay 14, 2025 am 12:13 AM

    ThesecrettokeepingaPHP-poweredwebsiterunningsmoothlyunderheavyloadinvolvesseveralkeystrategies:1)ImplementopcodecachingwithOPcachetoreducescriptexecutiontime,2)UsedatabasequerycachingwithRedistolessendatabaseload,3)LeverageCDNslikeCloudflareforservin

    Dependency Injection in PHP: Code Examples for BeginnersDependency Injection in PHP: Code Examples for BeginnersMay 14, 2025 am 12:08 AM

    You should care about DependencyInjection(DI) because it makes your code clearer and easier to maintain. 1) DI makes it more modular by decoupling classes, 2) improves the convenience of testing and code flexibility, 3) Use DI containers to manage complex dependencies, but pay attention to performance impact and circular dependencies, 4) The best practice is to rely on abstract interfaces to achieve loose coupling.

    PHP Performance: is it possible to optimize the application?PHP Performance: is it possible to optimize the application?May 14, 2025 am 12:04 AM

    Yes,optimizingaPHPapplicationispossibleandessential.1)ImplementcachingusingAPCutoreducedatabaseload.2)Optimizedatabaseswithindexing,efficientqueries,andconnectionpooling.3)Enhancecodewithbuilt-infunctions,avoidingglobalvariables,andusingopcodecaching

    PHP Performance Optimization: The Ultimate GuidePHP Performance Optimization: The Ultimate GuideMay 14, 2025 am 12:02 AM

    ThekeystrategiestosignificantlyboostPHPapplicationperformanceare:1)UseopcodecachinglikeOPcachetoreduceexecutiontime,2)Optimizedatabaseinteractionswithpreparedstatementsandproperindexing,3)ConfigurewebserverslikeNginxwithPHP-FPMforbetterperformance,4)

    PHP Dependency Injection Container: A Quick StartPHP Dependency Injection Container: A Quick StartMay 13, 2025 am 12:11 AM

    APHPDependencyInjectionContainerisatoolthatmanagesclassdependencies,enhancingcodemodularity,testability,andmaintainability.Itactsasacentralhubforcreatingandinjectingdependencies,thusreducingtightcouplingandeasingunittesting.

    Dependency Injection vs. Service Locator in PHPDependency Injection vs. Service Locator in PHPMay 13, 2025 am 12:10 AM

    Select DependencyInjection (DI) for large applications, ServiceLocator is suitable for small projects or prototypes. 1) DI improves the testability and modularity of the code through constructor injection. 2) ServiceLocator obtains services through center registration, which is convenient but may lead to an increase in code coupling.

    PHP performance optimization strategies.PHP performance optimization strategies.May 13, 2025 am 12:06 AM

    PHPapplicationscanbeoptimizedforspeedandefficiencyby:1)enablingopcacheinphp.ini,2)usingpreparedstatementswithPDOfordatabasequeries,3)replacingloopswitharray_filterandarray_mapfordataprocessing,4)configuringNginxasareverseproxy,5)implementingcachingwi

    PHP Email Validation: Ensuring Emails Are Sent CorrectlyPHP Email Validation: Ensuring Emails Are Sent CorrectlyMay 13, 2025 am 12:06 AM

    PHPemailvalidationinvolvesthreesteps:1)Formatvalidationusingregularexpressionstochecktheemailformat;2)DNSvalidationtoensurethedomainhasavalidMXrecord;3)SMTPvalidation,themostthoroughmethod,whichchecksifthemailboxexistsbyconnectingtotheSMTPserver.Impl

    See all articles

    Hot AI Tools

    Undresser.AI Undress

    Undresser.AI Undress

    AI-powered app for creating realistic nude photos

    AI Clothes Remover

    AI Clothes Remover

    Online AI tool for removing clothes from photos.

    Undress AI Tool

    Undress AI Tool

    Undress images for free

    Clothoff.io

    Clothoff.io

    AI clothes remover

    Video Face Swap

    Video Face Swap

    Swap faces in any video effortlessly with our completely free AI face swap tool!

    Hot Article

    Hot Tools

    SublimeText3 English version

    SublimeText3 English version

    Recommended: Win version, supports code prompts!

    PhpStorm Mac version

    PhpStorm Mac version

    The latest (2018.2.1) professional PHP integrated development tool

    SAP NetWeaver Server Adapter for Eclipse

    SAP NetWeaver Server Adapter for Eclipse

    Integrate Eclipse with SAP NetWeaver application server.

    Safe Exam Browser

    Safe Exam Browser

    Safe Exam Browser is a secure browser environment for taking online exams securely. This software turns any computer into a secure workstation. It controls access to any utility and prevents students from using unauthorized resources.

    WebStorm Mac version

    WebStorm Mac version

    Useful JavaScript development tools