Reputation: 546
Is it possible to display the pages under a sub folder inside a view in cakephp? Here's my folder structure:
<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>
Now how do I display the ctp files under tutors/managestudents? I tried typing in the browser localhost/school/tutors/managestudents/addlectures but that doesn't work.
i did also tried using the html helper link but still no luck
$this -> html -> link ('Add lectures, array('controller' => 'tutors, 'action' => 'ManageStudents/addlectures');
from what I have observed cake only displays the files under the view but It can't access the files inside a sub folder.
Upvotes: 2
Views: 970
Reputation: 976
First of all in the TutorsController.php
, you have to render it like the ff:
...
public function addlectures() {
...
$this->render('ManageStudents/addlectures');
}
....
And then, you have to configure routes.php
which is found in app/Config like this:
...
Router::connect('/Tutors/ManageStudents/addlectures', array('controller' => 'tutors, 'action'=> 'addlectures'));
..
this way you can add link like this:
$this->Html->link ('Add lectures, array('controller'=>'tutors, 'action' =>'addlectures');
and the browser will output it like ..../Tutors/ManageStudents/addlectures
Note: The whole Tutors folder should be inside app/Views folder
Hope it Helps!
Upvotes: 1