久久久久久久av_日韩在线中文_看一级毛片视频_日本精品二区_成人深夜福利视频_武道仙尊动漫在线观看

<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="qwawimqqmiuu" id='2xUKM'><tfoot id='2xUKM'></tfoot><dl id='2xUKM'><fieldset id='2xUKM'></fieldset></dl></div>
          <bdo id='2xUKM'></bdo><ul id='2xUKM'></ul>

        PHP:創建可擴展的 CMS 系統

        PHP: Creating Extensible CMS System(PHP:創建可擴展的 CMS 系統)
            <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="qwawimqqmiuu" 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:創建可擴展的 CMS 系統的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!

                  問題描述

                  客戶給了我一項新任務,主要是為演員/歌手等創建一個 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.

                  它基本上是一個軟件包,開箱即用,與 WordPress 非常相似,您只需將其交給購買它的人,當然這不會成為一個博客平臺.它將允許開發人員:

                  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:

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

                  我認為 觀察者模式 可能有用,但我不太確定.你們可以建議在以下方面創建這種靈活/可擴展的 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)
                  • 設計模式
                  • 任何其他事情

                  推薦答案

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

                  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.

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

                  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.

                  但這也帶來了一個問題.為了讓觀察者真正將自己附加到主題,它們必須被實例化.每一次.即使他們永遠不需要.那是愚蠢的.

                  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.

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

                  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.

                  因此,您可以為所有插件創建一個簡單的接口來實現.您需要的方法包括但不限于:

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

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

                  根據您采用插件概念的程度,您最終可能會得到具有用戶可配置選項的插件.您可能需要考慮到這一點.沿著這條路走下去的是瘋狂和配置系統.

                  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.

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

                  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.

                  小部件可以很容易地以類似的方式工作,就像在頁面呈現之前調用的插件一樣.

                  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 的限制令人難以置信,但如果您想確保模板中只運行經過批準的代碼,它可能是一個可行的選擇.此外,允許直接在應用程序本身中編輯 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 模板運行良好的原因之一是它們是純 PHP 的.他們可以調用 Wordpress API 中公開的任何方法,甚至可以執行自己有趣的邏輯.如果您希望您的最終用戶具有技術頭腦,或者至少具有技術能力,那么 PHP 模板就是您的最佳選擇.另一方面,如果惡意用戶進入管理位,允許在應用程序中編輯 PHP 模板可能會打開一個巨大的潛在安全漏洞.您可能想限制對文件系統的編輯.

                  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 創建,但您還應該考慮 CSS.您的最終用戶能否直接操作 CSS?他們愿意嗎?如果您的默認模板包含足夠多的語義類,那么如果他們知道自己在做什么,他們可能會毫不費力地進行大量樣式設置.另一方面,您的最終用戶可能不知道 CSS 是什么,所以他們可能想要,哦,比如說,顏色選擇器和預先構建的配色方案,以及配色方案選擇器,以及其他類似令人討厭的東西來構建.現在最好考慮一下那些恐怖事件.

                  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.

                  雜項.

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

                  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.)

                  你會使用 ORM 嗎?如果沒有,請確保使用適當的數據庫接口庫.PDO,或者來自 PEAR 的東西,或者 Zend_Db.您不可避免地會有一個客戶堅持代碼在 Oracle 或 MSSQL 上運行.或 SQLite.很高興告訴他們可以做到(需要付出一些努力).插件作者也會感謝您的理智.不要自己動手.

                  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.

                  (再說一次,對于您的代表級別,我希望您已經熟悉我所說的幾乎所有內容.啊,我做的事情是在思考自己的編碼問題時分散自己的注意力......)

                  (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...)

                  這篇關于PHP:創建可擴展的 CMS 系統的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!

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

                  相關文檔推薦

                  Deadlock exception code for PHP, MySQL PDOException?(PHP、MySQL PDOException 的死鎖異常代碼?)
                  PHP PDO MySQL scrollable cursor doesn#39;t work(PHP PDO MySQL 可滾動游標不起作用)
                  PHP PDO ODBC connection(PHP PDO ODBC 連接)
                  Using PDO::FETCH_CLASS with Magic Methods(使用 PDO::FETCH_CLASS 和魔術方法)
                  php pdo get only one value from mysql; value that equals to variable(php pdo 只從 mysql 獲取一個值;等于變量的值)
                  MSSQL PDO could not find driver(MSSQL PDO 找不到驅動程序)
                  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="qwawimqqmiuu" id='KmfLA'><tfoot id='KmfLA'></tfoot><dl id='KmfLA'><fieldset id='KmfLA'></fieldset></dl></div>
                            主站蜘蛛池模板: 天堂资源最新在线 | 四季久久免费一区二区三区四区 | 懂色中文一区二区在线播放 | 亚洲啪啪一区 | 日韩在线不卡视频 | 97超碰人人 | 亚洲高清视频一区二区 | 亚洲综合无码一区二区 | 一级黄色毛片免费 | 亚洲欧美日韩在线 | 精品国产黄色片 | 欧美中文在线 | 久久精品视频免费观看 | 欧美不卡视频一区发布 | 成人超碰 | 亚洲啊v在线 | 国产精品一区二区视频 | 韩日中文字幕 | 91在线观看免费视频 | 免费av直接看 | 国产精品爱久久久久久久 | 天天操网 | 性xxxxx | 开操网 | 欧美aaa级| 五月激情婷婷网 | 成人一区二区视频 | 免费在线观看一区二区 | 狠狠夜夜 | 综合久| 国产成人99久久亚洲综合精品 | 色综合天天综合网国产成人网 | 亚洲欧美中文日韩在线v日本 | 日产精品久久久一区二区福利 | 欧美日韩一区二区在线观看 | 精品久久久久久久久久久 | 精品国产一区二区三区性色av | 青娱乐av| 欧美日韩一区二区三区视频 | 亚洲精选一区 | 一级片视频免费 |