if i used this it's working. but if i rename function name, it shows error
IN view file:
echo $this->Html->link( '<span>Page 1</span>', array('action' => 'ra'), array('escape' => false));
In controller:
public function ra() { $this->render('ra'); } if i used this it's working. but if i rename function name, it shows error
IN view file:
echo $this->Html->link( '<span>Page 1</span>', array('action' => 'ra'), array('escape' => false));
In controller:
public function ra() { $this->render('ra'); } By convention, the view file must be the same as the method (action) name.
If you want to change the appearance of a URL, you should use routes, rather than rename your methods/views.
If you wish to render a different .ctp file for a given action, then you can override the default behaviour like so:
public function ra() { $this->render('my_other_view'); } The action specified in the URL must always exist to avoid an error (but routing lets you use alternative "names" for the action and maps them to the appropriate controller method).
View template files are named after the controller functions they display, in an underscored form. The getReady() function of the PeopleController class will look for a view template in /app/views/people/get_ready.ctp.
The basic pattern is /app/views/controller/underscored_function_name.ctp.
By naming the pieces of your application using CakePHP conventions, you gain functionality without the hassle and maintenance tethers of configuration. Here’s a final example that ties the conventions
Database table: “people” Model class: “Person”, found at /app/models/person.php Controller class: “PeopleController”, found at
/app/controllers/people_controller.php View template, found at /app/views/people/index.ctp Read : View Conventions
Also Read : CakePHP Conventions