I can’t seem to figure out how to use routing parameters and the set-function. Here is what I did:
Config/routes.php:
Router::connect('/professions/:linkname', array('controller' => 'professions', 'action' => 'display'));
Controller/ProfessionsController.php:
public function display($linkname = null) {
$this->set('test', $linkname);
//$this->set('profession', $this->findByLinkname($linkname));
}
View/Professions/display.ctp:
<?php echo $test; ?>
when I open /professions/test, the page is empty. Why? (As you can see, $test is only a test. I commented out what I really intended to do. But that is not working either)
Ok, RFTM… found it in the official book. Passing the parameters has to be specified like so:
Now it works.