cakePHP: Passing multiple parameters from view to controller in cakePHP

There is no direct specification for passing multiple parameters from view (.ctp file) to controller (.php file) in cakePHP. It is intuitive !
The format of the url with a single parameter look like : ../myApp/myController/myFunction/parameter1

To pass multiple parameters simply append at the end which might look like
../myApp/myController/myFunction/parameter1/parameter2/parameter3

Some generic ways are:
1.
array ('action' = '/myFunction/'. $id .'/'.$another_id); 

2.
$Html-> link ('edit', array ('url'='/ myController/myFunction? Id ='. $Id. '& another_id ='. $another_id)). 


3.
$Html-> link ('edit', array ('action' = 'myFunction', $id,$another_id)). 


The function in myController would look like:
 function myFunction ($id, $another_id){
   // do something
}

5 comments:

Python contextlib for Timing Python code

If you've ever found yourself needing to measure the execution time of specific portions of your Python code, the `contextlib` module o...