Hello All,

This is something interesting to implement.

Are you bored with .ctp extension in cakephp view file and want to have something interesting which helps to make coding even faster in cake, here is the solution to make .ctp extinsion change to .php

In your controller just add “ var $ext = ‘.php’ ” and make all your template files as .php insted of .ctp.

For example.

class UsersController extends AppController {

var $name = ‘Users’;
var $helpers = array(’Html’, ‘Form’,'Session’,'Javascript’);
var $components = array (’Auth’, ‘Cookie’, ‘RequestHandler’);
var $ext = ‘.php’;

function index() {
// Do something

}

}

Now create a file in app/views/users/index.php

The only use as far as i see of doing this is to make the coding editor friendly as the editor understand .php extension and not .ctp

Hope this tutorial helped you

Thanks and happy Algo blogging


« Alfresco - How to display custom aspects on Advanced Search Screen
Set JAVA_HOME environment variable on Red Hat Linux »


Leave a Reply