是否可以在cakephp视图中的子文件夹下显示页面?这是我的文件夹结构:
<pre>
-Views
|-Elements
|-Emails
|-Errors
|-Helpers
|-Homes
|-Layouts
|-Messages
|-Pages
|-Resources
|-Scaffolds
|-Tutors
|-ManageStudents
|-addlectures.ctp
|-editlecture.ctp
|-deletelecture.ctp
|-managestudents.ctp
|-index.ctp
|-profile.ctp
|-Webroots
</pre>现在如何显示导师/管理者下的ctp文件?我试着输入浏览器localhost/school/tutors/managestudents/addlectures,但这不起作用。
我也尝试过使用html助手链接,但仍然没有成功。
$this -> html -> link ('Add lectures, array('controller' => 'tutors, 'action' => 'ManageStudents/addlectures');据我所观察,蛋糕只显示视图下的文件,但它不能访问子文件夹中的文件。
发布于 2014-08-21 05:34:48
首先,在TutorsController.php中,您必须将其呈现为ff:
...
public function addlectures() {
...
$this->render('ManageStudents/addlectures');
}
....然后,您必须配置app/Config中的routes.php,如下所示:
...
Router::connect('/Tutors/ManageStudents/addlectures', array('controller' => 'tutors, 'action'=> 'addlectures'));
..这样您就可以添加如下链接:
$this->Html->link ('Add lectures, array('controller'=>'tutors, 'action' =>'addlectures');浏览器会像..../Tutors/ManageStudents/addlectures一样输出它
注意:整个家教文件夹应该在app/Views文件夹内。
希望能帮上忙!
https://stackoverflow.com/questions/25417642
复制相似问题