How do I access a CakePHP 1.3 view via its controller such that the URL route conforms to application/controller/view

51 views Asked by At

I have defined a Controller in CakePHP 1.3 legacy application running on IIS server windows server 2012, How do I access a view via its controller such that the URL route conforms to application/controller/view.

<?php
class NamesController extends AppController {
    var $helpers = array ('Html','Form');
    var $name = 'Names';


}
1

There are 1 answers

0
iamdeed On

you can define a function to access the view within the controller class, e.g.

function view() {
        //code for the function 
    }

complete code with function defined

<?php
class NamesController extends AppController {
    var $helpers = array ('Html','Form');
    var $name = 'Names';

    function view() {
        //code for the function 
    }
}
?>

route will now be able to accessed and view request is possible via the route URL application/controller/view Ensure that associated view is created in the views folder. URL Rewrite on IIS must be installed, and web.config setup with proper rewrite rules.