Skillbooker
Login Register

Cakephp


Parameters via the URL to next page in Cakephp

Sometimes the most simplistic things in php can be a headace in a framework like cakephp.

You can move parameters in two ways. Either use a named parameter where you call it by name or a un-named parameter where it is just passed.
In named:

You pass it like so:

<?php  if($records['User']['tablename'] > 0) { echo $this->Html->link(__('title here',true),array('plugin' => false, 'controller'=> 'user', 'action'=> 'index', 'userid' => $records['User']['id']),array('class'=>'btn btn-primary','escape'=>false));  } ?>

Then you receive it like:

echo $this->params['named']['userid'] // 'param'

in un - named parameters you send like:

<?php  if($records['User']['tablename'] > 0) { echo $this->Html->link(__('title here',true),array('plugin' => false 'controller'=> 'user', 'action'=> 'index', $records['User']['id']),array('class'=>'btn btn-primary','escape'=>false));  } ?>

Then you receive like:

echo $this->params['pass'][0] // 'passed_param'

 



Posted on: 2016-06-01 Please login/register to leave comments