Understanding the PAC framework of Druple

Drupal采用PAC(Presentation Abstraction Control)模型进行网站构建,该模型通过控制器处理逻辑、展示层负责设计、抽象层管理数据。文章详细介绍了PAC模型的工作原理及其与MVC模型的区别,展示了如何利用这一灵活的框架进行高效开发。

http://www.webhostinghero.ca/understanding-the-pac-framework-for-drupal.html

 

Understanding the PAC Framework for Drupal

Drupal’s structure is known as a PAC (presentation abstraction control) model which uses a controller to represent logic, a presentation layer for design and an abstraction layer for data.  Similar to an MVC framework, the components are unique and primarily communicate via API. In the structure, the Controller servers as the go between of the Presentation and Abstraction, which is why the templates are generated through function calls. The presentation, therefore, is just a rendering of a template, so you can focus on building out the core of the site and styling via CSS. In order to understand how PAC differs from other framework models, this article provides a theoretical overview of PAC for web development.

PAC is unique in that the various levels communicate with each other so you can create a broad structure. Sometimes the framework is also known as HMVC, or hierarchical model view controller for its nested structure. With the depth of Drupal sites, it’s much easier to build large sites that can scale across multiple business models.

For developers and publishers, this framework provides a way to create new membership structures and enables layers of the site to reflect unique presentation. One common example would be in an e-commerce site where the presentation for existing customers could be adapted to reflect their purchasing preferences. In this way you can utilize your site data to optimize its audience specific presentation. With a flexible structure, you can modify your Drupal app to derive more revenue and better value for each visitor.

How the PAC Structure Impacts the Drupal Model

In Drupal, the PAC structure provides a flexible framework for scale-able development. Menus in Drupal serve as controllers, which receive input via POST (or GET) functions, while data is stored in nodes, forms and entries in the Abstraction layers and the theme system provides a Presentation layer. While the overall structure may be new to many developers, its consistent logic and streamlined development can help accelerate and scale applications to new levels.

At the core the control layer plays a crucial role in gathering and transmitting data. With dual feedback between the abstraction and presentation layers, developers should focus on the control as the core of data transmission and structuring. The Presentation layer is solely to render the template, which itself makes API calls from functions as well as styling with CSS. At the back-end, the Abstraction layer provides storage for data in a SQL database (although recent versions of Drupal are compatible with a wide array of options.)

There are multiple PAC layers within Drupal which allows you to create a dynamic structure so the presentation and functions of the site are conditional upon the user, time or particular section. For example, the controller receives inputs from the user in terms of preferences; it may update the Presentation as well as storing the preference in the Abstraction layer. The controller can then update the child PAC elements so the entire user experience across the application reflects the newly entered preferences.

转载于:https://www.cnblogs.com/cy163/archive/2010/10/31/1865371.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值