嗨,我在我的 cakephp 中编写了以下代码。
<?php
//Posts is the name of my View folder, add, edit arethe pages in Posts folder.
echo $this->Posts('add_or_edit');
?>
<fieldset>
<legend>
<?php _('Add a Post'); ?>
</legend>
Please fill in all the fields.
<?php
echo $form->create('Post');
echo $form->error('Post.title');
echo $form->input('Post.title',array('id'=>'posttitle','label'=>'title','size'=>'50','maxlength'=>'255','error'=>false));
echo $form->error('Post.content');
echo $form->input('Post.content',array('id'=>'postcontent','type'=>'textarea','label'=>'Content:','rows'=>'10','error'=>false));
echo $form->end(array('label'=>'Submit Post'));
?>
</fieldset>
好吧,每当我尝试显示上面的代码时,我都会收到这样的错误
Call to undefined method View::Posts() in C:\wamp\www\cake_php\app\View\Posts\add.ctp on line 2
我的代码有问题还是我需要更改我的视图文件?