您好我有一个cakephp页面,当您将鼠标悬停在链接上时,它会显示正确的链接,但是当您单击该链接时,它会将您带到完全不同的/错误的页面。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);
}
:在此处分享您的控制器代码 – chetanspeed511987
我已经意识到它会自动重定向该页面。我现在更新控制器代码 – user1393064