What is the default extension of view files in cakephp?can we change it?if yes then how?  

Report
Question
34 views

Please explain why do you think this question should be reported?

Report Cancel

default extension of view files is '.ctp'.
yes we can change it by writing public $ext = '.yourext'; in AppController.If you want to change it for particular controller then add it into that controller only.You can also change it for the specific action of the controller by putting it in that action of controller.
public $ext = '.yourext'; in AppController
 – you can change all the views extentions.

 public $ext = '.yourext';  in specific controller like, PostsController
– you can change all the views extentions of PostsController.

public $ext = '.yourext';  in specific controller action like, index()
– you can change the view extention of index.ctp 
Note: You cannot specify multiple extensions, however it seems like there is a fall back to .ctp if no .php file is found.

Please follow and like us: