Creating a view (cakePHP noob) -
i've been reading until eyes swollen, , having troubles finding should simple answer.
i not new php, new cakephp. please bear me, , have patience ignorance of lack of knowledge of terminology.
i have been asked make fixes on cakephp developed site, created.
the site missing page "http://domain.com/logout". can see functions need access in usercontroller, not sure put .ctp file generate view.
let's want logout.ctl file simple as: echo "hello world";
under app/view folder have sub-folders home, & user have tried place file into. assuming have else well, have not been able locate is.
any assistance appreciated. reading!
1.by default, should link view , controller creating views/controller/action.ctp.
since url linked controller routes, views not associated directly.
for example, if have set
router::connect('/logout/', array('controller' => 'user', 'action' => 'logout'));   , may want create views/user/logout.ctp.
if have set
router::connect('/logout/', array('controller' => 'home', 'action' => 'logout'));   , may want create views/home/logout.ctp.
2.you can change view in action $this->view='sample' or $this->render('sample'); , create view file name sample.ctp.
3.you can read view of folder $this->render('/sample/logout');. reference: http://book.cakephp.org/2.0/en/controllers.html
4.if use themes $this->theme = 'example';, default view file set /app/view/themed/example/posts/edit.ctp. reference: http://book.cakephp.org/2.0/en/views/themes.html
5.i think default extension of cakephp view files .ctp not .ctl. .ctl used microsoft visual studio? i'm not quite sure.
Comments
Post a Comment