pbootcms网站模板|日韩1区2区|织梦模板||网站源码|日韩1区2区|jquery建站特效-html5模板网

<legend id='2xUKM'><style id='2xUKM'><dir id='2xUKM'><q id='2xUKM'></q></dir></style></legend>

      1. <tfoot id='2xUKM'></tfoot>

        <small id='2xUKM'></small><noframes id='2xUKM'>

        <i id='2xUKM'><tr id='2xUKM'><dt id='2xUKM'><q id='2xUKM'><span id='2xUKM'><b id='2xUKM'><form id='2xUKM'><ins id='2xUKM'></ins><ul id='2xUKM'></ul><sub id='2xUKM'></sub></form><legend id='2xUKM'></legend><bdo id='2xUKM'><pre id='2xUKM'><center id='2xUKM'></center></pre></bdo></b><th id='2xUKM'></th></span></q></dt></tr></i><div class="wuq0s2m" id='2xUKM'><tfoot id='2xUKM'></tfoot><dl id='2xUKM'><fieldset id='2xUKM'></fieldset></dl></div>
          <bdo id='2xUKM'></bdo><ul id='2xUKM'></ul>

        PHP:創(chuàng)建可擴(kuò)展的 CMS 系統(tǒng)

        PHP: Creating Extensible CMS System(PHP:創(chuàng)建可擴(kuò)展的 CMS 系統(tǒng))
            <tbody id='X9jul'></tbody>

            • <bdo id='X9jul'></bdo><ul id='X9jul'></ul>

              1. <small id='X9jul'></small><noframes id='X9jul'>

                1. <tfoot id='X9jul'></tfoot>
                2. <i id='X9jul'><tr id='X9jul'><dt id='X9jul'><q id='X9jul'><span id='X9jul'><b id='X9jul'><form id='X9jul'><ins id='X9jul'></ins><ul id='X9jul'></ul><sub id='X9jul'></sub></form><legend id='X9jul'></legend><bdo id='X9jul'><pre id='X9jul'><center id='X9jul'></center></pre></bdo></b><th id='X9jul'></th></span></q></dt></tr></i><div class="cag2em2" id='X9jul'><tfoot id='X9jul'></tfoot><dl id='X9jul'><fieldset id='X9jul'></fieldset></dl></div>
                  <legend id='X9jul'><style id='X9jul'><dir id='X9jul'><q id='X9jul'></q></dir></style></legend>

                  本文介紹了PHP:創(chuàng)建可擴(kuò)展的 CMS 系統(tǒng)的處理方法,對(duì)大家解決問(wèn)題具有一定的參考價(jià)值,需要的朋友們下面隨著小編來(lái)一起學(xué)習(xí)吧!

                  問(wèn)題描述

                  客戶給了我一項(xiàng)新任務(wù),主要是為演員/歌手等創(chuàng)建一個(gè) CMS,客戶將向他們出售.

                  I have been given a new task from the client which is basically creating a CMS for actors/singers and the like that client will be selling out to them.

                  它基本上是一個(gè)軟件包,開(kāi)箱即用,與 WordPress 非常相似,您只需將其交給購(gòu)買(mǎi)它的人,當(dāng)然這不會(huì)成為一個(gè)博客平臺(tái).它將允許開(kāi)發(fā)人員:

                  It will basically be a package and would work out-of-box pretty much similar to WordPress, you just hand over to whoever buys it but of course this is not going to be a blogging platform. It will allow developers to:

                  • 添加插件/小部件
                  • 添加模板/主題

                  我認(rèn)為 觀察者模式 可能有用,但我不太確定.你們可以建議在以下方面創(chuàng)建這種靈活/可擴(kuò)展的 CMS:

                  I thought the Observer Pattern may be useful but I am not that sure about it. What you guys could suggest to create such flexible/extensible CMS in terms of:

                  • 能夠添加插件(例如 WordPress)
                  • 能夠添加主題/模板(例如 WordPress)
                  • 設(shè)計(jì)模式
                  • 任何其他事情

                  推薦答案

                  Observer 很好,但您將不得不考慮超越基本模式.規(guī)范的觀察者/主題模式只將主題對(duì)象發(fā)送給觀察者,沒(méi)有別的,甚至沒(méi)有為什么通知它.

                  Observer's fine, but you're going to have to consider going beyond the basic pattern. The canonical Observer/Subject pattern only sends the Subject object to the Observer, nothing else, not even why it's being notified.

                  最初,解決方案似乎還包括向觀察者發(fā)出通知的原因,但隨后您可能最終會(huì)通知不關(guān)心某些通知的觀察者.更好的解決方案可能是要求觀察者還要求提供他們希望收到的通知列表.

                  Initially, the solution might seem like also including the reason for the notification to the Observer, but then you might end up notifying Observers that don't care about certain notifications. A better solution might be requiring Observers to also ask for a list of notifications they'd like to receive.

                  但這也帶來(lái)了一個(gè)問(wèn)題.為了讓觀察者真正將自己附加到主題,它們必須被實(shí)例化.每一次.即使他們永遠(yuǎn)不需要.那是愚蠢的.

                  But that also presents a problem. In order for the Observers to actually attach themselves to Subjects, they have to be instantiated. Every single time. Even if they'd never be needed. That's silly.

                  因此,我們很快就達(dá)到了插件的規(guī)范 PHP 實(shí)現(xiàn)之一:hooks".Hooks 使用與 Observer/Subject 相同的概念,但在一個(gè)非常重要的方面實(shí)現(xiàn)不同:實(shí)際的 Observers 不是為了觀察 Subjects 而實(shí)例化的.相反,Subjects 向某種中央存儲(chǔ)庫(kù)發(fā)送通知.該存儲(chǔ)庫(kù)配置了所有已安裝和激活插件(觀察者)的列表,并包含每個(gè)插件想要接收的所有事件的列表.每個(gè)插件僅在事件發(fā)生時(shí)通知,通常通過(guò)靜態(tài)方法而不是通過(guò)創(chuàng)建插件實(shí)例并通知它.call_user_func_array 和一個(gè)好的自動(dòng)加載器使這變得非常簡(jiǎn)單.

                  So, we've quickly reached one of the canonical PHP implementations of plugins: "hooks". Hooks use the same concept as Observer/Subject, but the implementation is different in a very important way: the actual Observers aren't instantiated in order to Observe Subjects. Instead, Subjects send a notification to some variety of central repository. This repository is configured with a list of all installed and activated plugins (Observers), and contains a list of all of the events that each plugin wants to receive. Each plugin and notified only when the event takes place, often through a static method rather than by creating an instance of the plugin and notifying it. call_user_func_array and a good autoloader makes this incredibly trivial.

                  因此,您可以為所有插件創(chuàng)建一個(gè)簡(jiǎn)單的接口來(lái)實(shí)現(xiàn).您需要的方法包括但不限于:

                  You can therefore create a simple Interface for all plugins to implement. Methods that you'll need include but are not limited to:

                  • 用于獲取有關(guān)插件數(shù)據(jù)的內(nèi)容,例如名稱、作者、官方網(wǎng)站、版本等.人類可使用的信息.
                  • 返回插件想要訂閱的事件的方法.
                  • 一種安裝方法,用于插件為了安裝自身而需要做的事情,例如操作數(shù)據(jù)庫(kù).
                  • 卸載方法也可能很方便.
                  • 將接收事件通知并返回所需數(shù)據(jù)的(可能是靜態(tài)的)方法.

                  根據(jù)您采用插件概念的程度,您最終可能會(huì)得到具有用戶可配置選項(xiàng)的插件.您可能需要考慮到這一點(diǎn).沿著這條路走下去的是瘋狂和配置系統(tǒng).

                  Depending on how far you take the plugin concept, you could end up with plugins that have user configurable options. You might need to take that into account. Down that road lies madness and configuration systems.

                  為了使插件有效,您需要到處放置鉤子,并經(jīng)常與最終用戶合作,在需要的地方添加新的鉤子.

                  In order to make plugins effective, you're going to need to place hooks everywhere, and frequently work with end-users to add new hooks where they are needed.

                  小部件可以很容易地以類似的方式工作,就像在頁(yè)面呈現(xiàn)之前調(diào)用的插件一樣.

                  Widgets can easily work in a similar way, as plugins that get called prior to page rendering.

                  主題/模板,天哪.您可能有兩大選擇.

                  Themes/templates, oh my. You probably have two big options.

                  1. Smarty 或類似的模板引擎.或者您自己的非 PHP 模板引擎.
                  2. PHP 模板.

                  此決定將由您的最終用戶決定.Smarty 的限制令人難以置信,但如果您想確保模板中只運(yùn)行經(jīng)過(guò)批準(zhǔn)的代碼,它可能是一個(gè)可行的選擇.此外,允許直接在應(yīng)用程序本身中編輯 Smarty 模板并不是不安全的.

                  This decision will be driven by your end users. Smarty is incredibly limiting, but if you want to make sure that only approved code runs in a template, it might be a viable option. Furthermore, it's not unsafe to allow editing of Smarty templates right in the application itself.

                  另一方面,Wordpress 模板運(yùn)行良好的原因之一是它們是純 PHP 的.他們可以調(diào)用 Wordpress API 中公開(kāi)的任何方法,甚至可以執(zhí)行自己有趣的邏輯.如果您希望您的最終用戶具有技術(shù)頭腦,或者至少具有技術(shù)能力,那么 PHP 模板就是您的最佳選擇.另一方面,如果惡意用戶進(jìn)入管理位,允許在應(yīng)用程序中編輯 PHP 模板可能會(huì)打開(kāi)一個(gè)巨大的潛在安全漏洞.您可能想限制對(duì)文件系統(tǒng)的編輯.

                  On the other hand, one of the reason Wordpress templates work so well is that they're pure PHP. They can call any method exposed in the Wordpress API, and even do their own interesting logic. If you expect your end users to be technically minded, or at least technically competent, then PHP templates are the way to go. On the other hand, allowing editing of PHP templates within the application can open up a huge potential security hole if a malicious user gets into the admin bits. You probably want to restrict editing to the filesystem.

                  雖然這涵蓋了 HTML 創(chuàng)建,但您還應(yīng)該考慮 CSS.您的最終用戶能否直接操作 CSS?他們?cè)敢鈫?如果您的默認(rèn)模板包含足夠多的語(yǔ)義類,那么如果他們知道自己在做什么,他們可能會(huì)毫不費(fèi)力地進(jìn)行大量樣式設(shè)置.另一方面,您的最終用戶可能不知道 CSS 是什么,所以他們可能想要,哦,比如說(shuō),顏色選擇器和預(yù)先構(gòu)建的配色方案,以及配色方案選擇器,以及其他類似令人討厭的東西來(lái)構(gòu)建.現(xiàn)在最好考慮一下那些恐怖事件.

                  While this covers HTML creation, you should also take CSS into consideration. Will your end-users be able to manipulate CSS directly? Will they want to? If your default templates include enough semantic classes, they can probably do a great deal of styling with not a lot of effort, if they know what they're doing. On the other hand, your end-users might not know what CSS is, so they might want, oh, say, color pickers and pre-built color schemes, and a color scheme chooser, and other such annoying things to build. It's probably best to think about those horrors now.

                  雜項(xiàng).

                  如果沒(méi)有草稿和發(fā)布狀態(tài)的概念,任何 CMS 都是不完整的.除了先編碼之外,我在這里沒(méi)有給你任何建議.如果您的客戶或最終用戶想要任何類型的歷史存檔、管理審批機(jī)制或任何其他使草稿/發(fā)布的內(nèi)容不只是簡(jiǎn)單狀態(tài)字段的內(nèi)容,您需要很快知道.(我被這個(gè)深深地咬住了.我們圍繞一個(gè)簡(jiǎn)單的已發(fā)布/未發(fā)布的模型設(shè)計(jì)了整個(gè)系統(tǒng),并在我們意識(shí)到它不起作用時(shí)通過(guò)規(guī)范構(gòu)建和相關(guān)原型代碼獲得了大約 9/10我們必須做一些更遠(yuǎn)、更復(fù)雜的事情才能真正滿足客戶的要求.重建粗略的計(jì)劃是我們迄今為止遇到的最大的一次浪費(fèi)時(shí)間.)

                  No CMS would be complete without the concept of drafts and publish states. I don't have any advice for you here, other than code this first. If your customer or the end-users want any sort of historical archiving, managerial approval mechanism, or anything else that makes draft/published anything but a simple state field, you need to know very soon. (I've been bitten horribly by this one. We'd designed the entire system around a simple published/not-published model, and got about 9/10ths through spec building and related prototype code when we realized it wouldn't work and we'd have to do something far, far more complex to actually meet customer requirements. Rebuilding the rough plan was the single largest time-sink we encountered so far.)

                  你會(huì)使用 ORM 嗎?如果沒(méi)有,請(qǐng)確保使用適當(dāng)?shù)臄?shù)據(jù)庫(kù)接口庫(kù).PDO,或者來(lái)自 PEAR 的東西,或者 Zend_Db.您不可避免地會(huì)有一個(gè)客戶堅(jiān)持代碼在 Oracle 或 MSSQL 上運(yùn)行.或 SQLite.很高興告訴他們可以做到(需要付出一些努力).插件作者也會(huì)感謝您的理智.不要自己動(dòng)手.

                  Will you use an ORM? If not, be sure to use a proper database interface library. PDO, or maybe something from PEAR, or maybe Zend_Db. You'll inevitably have a customer that will insist that the code runs on Oracle or MSSQL. Or SQLite. It'll be nice to tell them it can be done (with some effort). Plugin authors will thank you for the sanity as well. Don't roll your own.

                  (再說(shuō)一次,對(duì)于您的代表級(jí)別,我希望您已經(jīng)熟悉我所說(shuō)的幾乎所有內(nèi)容.啊,我做的事情是在思考自己的編碼問(wèn)題時(shí)分散自己的注意力......)

                  (Then again, with your rep level, I expect that you're already familiar with pretty much everything I've said. Ah, the things I do to distract myself while thinking about my own set of coding problems...)

                  這篇關(guān)于PHP:創(chuàng)建可擴(kuò)展的 CMS 系統(tǒng)的文章就介紹到這了,希望我們推薦的答案對(duì)大家有所幫助,也希望大家多多支持html5模板網(wǎng)!

                  【網(wǎng)站聲明】本站部分內(nèi)容來(lái)源于互聯(lián)網(wǎng),旨在幫助大家更快的解決問(wèn)題,如果有圖片或者內(nèi)容侵犯了您的權(quán)益,請(qǐng)聯(lián)系我們刪除處理,感謝您的支持!

                  相關(guān)文檔推薦

                  Deadlock exception code for PHP, MySQL PDOException?(PHP、MySQL PDOException 的死鎖異常代碼?)
                  PHP PDO MySQL scrollable cursor doesn#39;t work(PHP PDO MySQL 可滾動(dòng)游標(biāo)不起作用)
                  PHP PDO ODBC connection(PHP PDO ODBC 連接)
                  Using PDO::FETCH_CLASS with Magic Methods(使用 PDO::FETCH_CLASS 和魔術(shù)方法)
                  php pdo get only one value from mysql; value that equals to variable(php pdo 只從 mysql 獲取一個(gè)值;等于變量的值)
                  MSSQL PDO could not find driver(MSSQL PDO 找不到驅(qū)動(dòng)程序)
                  1. <legend id='KmfLA'><style id='KmfLA'><dir id='KmfLA'><q id='KmfLA'></q></dir></style></legend>
                      <tbody id='KmfLA'></tbody>
                      <bdo id='KmfLA'></bdo><ul id='KmfLA'></ul>

                        <small id='KmfLA'></small><noframes id='KmfLA'>

                        <tfoot id='KmfLA'></tfoot>

                          <i id='KmfLA'><tr id='KmfLA'><dt id='KmfLA'><q id='KmfLA'><span id='KmfLA'><b id='KmfLA'><form id='KmfLA'><ins id='KmfLA'></ins><ul id='KmfLA'></ul><sub id='KmfLA'></sub></form><legend id='KmfLA'></legend><bdo id='KmfLA'><pre id='KmfLA'><center id='KmfLA'></center></pre></bdo></b><th id='KmfLA'></th></span></q></dt></tr></i><div class="ye0gcqk" id='KmfLA'><tfoot id='KmfLA'></tfoot><dl id='KmfLA'><fieldset id='KmfLA'></fieldset></dl></div>
                            主站蜘蛛池模板: 龙门加工中心-数控龙门加工中心厂家价格-山东海特数控机床有限公司_龙门加工中心-数控龙门加工中心厂家价格-山东海特数控机床有限公司 | 安平县鑫川金属丝网制品有限公司,声屏障,高速声屏障,百叶孔声屏障,大弧形声屏障,凹凸穿孔声屏障,铁路声屏障,顶部弧形声屏障,玻璃钢吸音板 | 袋式过滤器,自清洗过滤器,保安过滤器,篮式过滤器,气体过滤器,全自动过滤器,反冲洗过滤器,管道过滤器,无锡驰业环保科技有限公司 | Magnescale探规,Magnescale磁栅尺,Magnescale传感器,Magnescale测厚仪,Mitutoyo光栅尺,笔式位移传感器-苏州连达精密量仪有限公司 | 华夏医界网_民营医疗产业信息平台_民营医院营销管理培训 | 亚克力制品定制,上海嘉定有机玻璃加工制作生产厂家—官网 | 苏州工作服定做-工作服定制-工作服厂家网站-尺品服饰科技(苏州)有限公司 | 嘉兴恒升声级计-湖南衡仪声级计-杭州爱华多功能声级计-上海邦沃仪器设备有限公司 | 细石混凝土泵_厂家_价格-烟台九达机械有限公司 | 探鸣起名网-品牌起名-英文商标起名-公司命名-企业取名包满意 | 高压分散机(高压细胞破碎仪)百科-北京天恩瀚拓 | 锤式粉碎机,医药粉碎机,锥式粉碎机-无锡市迪麦森机械制造有限公司 | 承插管件_不锈钢承插管件_锻钢高压管件-温州科正阀门管件有限公司 | 上海公众号开发-公众号代运营公司-做公众号的公司企业服务商-咏熠软件 | 400电话_400电话申请_866元/年_【400电话官方业务办理】-俏号网 3dmax渲染-效果图渲染-影视动画渲染-北京快渲科技有限公司 | ★店家乐|服装销售管理软件|服装店收银系统|内衣店鞋店进销存软件|连锁店管理软件|收银软件手机版|会员管理系统-手机版,云版,App | 高低温试验房-深圳高低温湿热箱-小型高低温冲击试验箱-爱佩试验设备 | 聚氨酯催化剂K15,延迟催化剂SA-1,叔胺延迟催化剂,DBU,二甲基哌嗪,催化剂TMR-2,-聚氨酯催化剂生产厂家 | 杭州标识标牌|文化墙|展厅|导视|户内外广告|发光字|灯箱|铭阳制作公司 - 杭州标识标牌|文化墙|展厅|导视|户内外广告|发光字|灯箱|铭阳制作公司 | 广东成考网-广东成人高考网| 威廉希尔WilliamHill·足球(中国)体育官方网站 | 找培训机构_找学习课程_励普教育| 广州食堂承包_广州团餐配送_广州堂食餐饮服务公司 - 旺记餐饮 | 必胜高考网_全国高考备考和志愿填报信息平台 | 不锈钢搅拌罐_高速搅拌罐厂家-无锡市凡格德化工装备科技有限公司 | 定坤静电科技静电消除器厂家-除静电设备 | 冷柜风机-冰柜电机-罩极电机-外转子风机-EC直流电机厂家-杭州金久电器有限公司 | 高清视频编码器,4K音视频编解码器,直播编码器,流媒体服务器,深圳海威视讯技术有限公司 | 安规_综合测试仪,电器安全性能综合测试仪,低压母线槽安规综合测试仪-青岛合众电子有限公司 | 冷水机-冰水机-冷冻机-冷风机-本森智能装备(深圳)有限公司 | 线粒体膜电位荧光探针-细胞膜-标记二抗-上海复申生物科技有限公司 | 雨水收集系统厂家-雨水收集利用-模块雨水收集池-徐州博智环保科技有限公司 | 高压管道冲洗清洗机_液压剪叉式升降机平台厂家-林君机电 | 金库门,金库房,金库门厂家,金库门价格-河北特旺柜业有限公司 | 复盛空压机配件-空气压缩机-复盛空压机(华北)总代理 | 工作心得_读书心得_学习心得_找心得体会范文就上学道文库 | 圆盘鞋底注塑机_连帮鞋底成型注塑机-温州天钢机械有限公司 | 线材成型机,线材折弯机,线材成型机厂家,贝朗自动化设备有限公司1 | 德国EA可编程直流电源_电子负载,中国台湾固纬直流电源_交流电源-苏州展文电子科技有限公司 | 品牌策划-品牌设计-济南之式传媒广告有限公司官网-提供品牌整合丨影视创意丨公关活动丨数字营销丨自媒体运营丨数字营销 | 碳钢法兰厂家,非标法兰,定制异型,法兰生产厂家-河北九瑞管道 |