大家好,我有一个 cakephp 页面,当您将鼠标悬停在链接上时,它会显示正确的链接,但是当您单击该链接时,它会将您带到一个完全不同/错误的页面。
我认为这是我的观点错误,所以我将在此处包含网站的相关部分,正在发生的事情是add link
让用户fields/view
不要fields/add_new
<tr>
<td align='center'><?php echo $templates['Template']['name'] ;?></td>
<td align='center'><?php echo $templates['Template']['description']; ?> </td>
<td align='center'>
<?php echo $this->Form->Html->link('Add', array('controller' => 'Fields','action'=>'add_new',$templates['Template']['id'])); ;?> |
<?php echo $this->Form->Html->link('View', array('controller' => 'Fields','action'=>'view',$templates['Template']['id'])); ;?> |
<?php echo $this->Form->Html->link('Edit', array('controller' => 'Templates','action'=>'edit',$templates['Template']['id'])); ;?> |
<?php echo $this->Form->Html->link('Delete', array('controller' => 'Templates','action'=>'delete',$templates['Template']['id'])); ;?></td>
<tr>
function add_new($id=null){
//allows users to add another field to an existing template
$this->set('title_for_layout', 'Create Fields');
$this->set('stylesheet_used', 'homestyle');
$this->set('image_used', 'eBOXLogoHome.png');
$this->layout='home_layout';
if(($this->Field->save($this->request->data)))
{
$id = $this->data['Field']['template_id'];
$this->set('id',$id);
$this->redirect(array('controller'=>'Fields', 'action'=>'view',$id));
}
$this->set('id',$id);
}