CakePHP控制器

发布时间:2022-04-30 发布网站:脚本宝典
脚本宝典收集整理的这篇文章主要介绍了CakePHP控制器脚本宝典觉得挺不错的,现在分享给大家,也给大家做个参考。
您好我正在为Cake PHP添加动态子菜单并收到此错误

Notice (8): Undefined PRoPErty: PagesController::$GamesRewiewTypes

我创建了名为rewiew_types_controller.PHP的控制器,它不起作用?

App_Controller.PHP

$rewiewTypes = $this->GamesRewiewTypes->find('all',array('condITions' => array('GamesRewiewTypes.menu_show' => 1),'order' => 'GamesRewiewTypes.title ASC'));

    $rewiewTypes = Set::combine($rewiewTypes,'{n}.GamesRewiewTypes.title',array('/reviews/{0}','{n}.GamesRewiewTypes.id'));



    $mainMenu = array(

        '3dreviews' => $rewiewTypes,);

Rewiews_Type_Controller.PHP

class RewiewTypesController extends AppController {
VAR $name = 'rewiewTypes';
var $uses = array('GamesRewiewTypes');

Pages_Controller.PHP

class PagesController extends AppController {
var $uses = array('Banner');

public function index() {
    $banners = $this->Banner->find('all',array('order' => 'position ASC'));
    $this->set('banners',$banners);
    /*
    pr ($banners);
    exit;
    */
}

解决方法

用你的app_controller和pages_controller替换$uses

var $uses = array('Banner','GamesRewiewTypes');

应该够了吧

脚本宝典总结

以上是脚本宝典为你收集整理的CakePHP控制器全部内容,希望文章能够帮你解决CakePHP控制器所遇到的问题。

如果觉得脚本宝典网站内容还不错,欢迎将脚本宝典推荐好友。

本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。