07 January 2007

CakePHP 应用程序的数据流小结 · Summary of Data Flow in CakePHP Web Application



1. Controllers fetch data in database through Models, and set to vars which are available in Views.
1. Controllers(控制类) 通过 Models(模型类) 取得数据库的数据, 并赋给 Views 中能看到的变量。

2. Controllers accept data from Webpages through vars such as 'params'.
2. Controllers(控制类) 使用变量如 'params', 接受网页的数据。

3. Data in Sessions would be handled by Session vars.
3. 会话(Session)中的数据有专门的会话变量来处理。

4. Views call renderElement() to display repeatable Element files (i.e. mini-views) and pass parameters.
4. Views(视图类) 调用 renderElement() 来显示可重复用的 Element(元素) 文件 (即: 迷你视图) 并传递参数。

5. render() is automatically called at the end of each controller action to render its View. But redirect() and flash() is used for redirection.
5. 控制类的每个动作结束时能自动调用 render() 来递送 Views。而 redirect() 和 flash() 可用来转向。

6. There are many special functions and variables in Controllers.
6. 控制类中还有一些专门的函数和变量。