`
icrwen
  • 浏览: 261576 次
  • 性别: Icon_minigender_2
  • 来自: 济南
社区版块
存档分类
最新评论

cakephp工作笔记20110601_控制器中访问其他控制器方法

    博客分类:
  • php
阅读更多
requestAction(string $url, array $options)

This function calls a controller's action from any location and returns data from the action. The $url passed is a CakePHP-relative URL (/controllername/actionname/params). To pass extra data to the receiving controller action add to the $options array.
You can use requestAction() to retrieve a fully rendered view by passing 'return' in the options: requestAction($url, array('return'));. It is important to note that making a requestAction using 'return' from a controller method can cause script and css tags to not work correctly.

If used without caching requestAction can lead to poor performance. It is rarely appropriate to use in a controller or model.

requestAction is best used in conjunction with (cached) elements – as a way to fetch data for an element before rendering. Let's use the example of putting a "latest comments" element in the layout. First we need to create a controller function that will return the data.
When an action is called through requestAction $this->params['requested'] is set to 1 as an indicator. So checking that you can either return the required data else set it a view variable like you normally would. This helps keep things DRY.
例子:
在air_status控制器中调用stores_houses的方法shlistdir
function airscene()
{
$this->layout = "iframe";
$rs = $this->requestAction('/stores_houses/shlistdir');
$this->set('test',$rs);
}


隐藏GridPanel表头上的排序下拉菜单

文章分类:Web前端
写道
gridPanel的配置项里加上 enableHdMenu :false  即可
分享到:
评论

相关推荐

    cakephp--使用_CakePHP_的_Session_和_Request_Handler_组件

    cakephp--使用_CakePHP_的_Session_和_Request_Handler_组件

    cakephp-v4.0.5_TheWeb_cakephp_faceeev_php_

    CakePHP是一个用PHP编写的开源Web应用框架,不过其模型是用Ruby on Rails设计的。作为PHP世界的Rails,CakePHP采纳了RoR的许多...在cakephp.org站点的Sites in the wild页面可以看到当前使用CakePHP框架的网站列表。

    使用_CakePHP_快速打造_Web_站点

    本教程向您展示如何开始使用 CakePHP。您将亲历整个安装过程,然后实际编写用户注册代码。通过这些过程,您将看到使用 CakePHP 究竟可以节省多少时间。本教程将构建在线产品应用程序 Tor,它包含一个 “request ...

    cakephp-cakephp-1.3.12-32-gb4e3c8a.zip_cakephp 1.3_cakephp1.3_ca

    一个很流行的php框架,cakephp,支持MVC模式

    cakephp.zip_Known_structured design

    CakePHP is a rapid development framework for PHP which uses commonly known design patterns like Associative Data Mapping, Front Controller, and MVC. Our primary goal is to provide a structured ...

    cakephp 中文手册

    cakephp 中文手册cakephp 中文手册cakephp 中文手册cakephp 中文手册

    cakephp学习笔记

    CakePHP是一个基于PHP,免费且开源的迅速发展框架 主要特性:  兼容PHP4和PHP5  数据库交互运用了CRUD(create, read, update and delete),即增查改删。  代码自动产生(代码产生器)  MVC体系架构 ...

    cakephp_bate.zip_The Front

    在cakephp.org站点的Sites in the wild页面可以看到当前使用CakePHP框架的网站列表。 CakePHP 是一个运用了诸如ActiveRecord、Association Data Mapping、Front Controller和MVC等著名设计模式的快速开发框架。该...

    CakePHP创建验证器

    使用CakePHP框架如何创建验证器的文档。验证器可以通过在控制器中加入以下代码被创建,一旦创建了验证器,我们就可以使用验证器实例验证数据。

    cakephp中acl详解

    cakephp中acl详解

    cakephp-2.2.4.rar_cakephp

    CakePHP是一个快速开发PHP的开发框架,其中使用了一些常见的设计模式如ActiveRecord,Association Data Mapping,Front Controller以及MVC。其主要目标在于提供一个令任意水平的PHP开发人员都能够快速开发web应用的...

    cakephp 中文文档

    全面的cakephp中文文档

    cakephp.rar_MVC架构_Web应用框架

    CakePHP是一个用PHP编写的开源Web应用框架 主要特性: 基于MVC架构 视图支持Ajax 内置校验框架 提供应用程序的基础模块和CRUD 代码自动生成功能 提供处理session,request,security的组件 灵活的视图缓存功能 面向...

    CakePHP 1.2 API 中文文档

    这是CakePHP 1.2 API 中文文档,是中文API。解压后,找到其中index.htm文件,打开浏览就可以了。相信对不喜欢E文人有很大帮助,其它的就不多说了,自己看就知道了。

    cakephp中文手册API

    cakephp框架,api中文手册,初学者必看

    cakephp-4.0.3_Web应用框架_mvc_shakingjk3_php_

    CakePHP是一个快速开发PHP的开发框架,其中使用了一些常见的设计模式如ActiveRecord,Association Data Mapping,Front Controller以及MVC,其主要目标在于提供一个令任意水平的PHP开发人员都能快速开发web应用的...

    CakePHP中文手册

    CakePHP中文手册

    cakephp中acl详解.rar

    cakephp中acl详解

    cakephp中文手册

    cakephp中文手册

    cakePHP 中文手册

    CakePHP有多个特点,这些特点让CakePHP成为了快速开发框架中的佼佼者之一。 1.活跃友好的社区 2.灵活的许可协议(Licensing) 3.兼容PHP4和PHP5 4.数据库交互和简单查询的集成 5.应用程序Scaffolding 6....

Global site tag (gtag.js) - Google Analytics