2012-10-15 65 views
1

我在我的CakePHP项目中使用jquery选项卡。这里是我的脚本:Jquery选项卡和CakePHP

$(function() { 
     $("#tabs").tabs(); 
}); 

这里是我的标签

<div id="tabs"> 
    <ul> 
     <li><?php echo $this->Html->link('Statistics', array('action' => 'overview_stats', $current_user['id']))?></li> 
     <li><?php echo $this->Html->link('Orders', array('action' => 'overview_orders', $current_user['id']))?></li> 
     <li><?php echo $this->Html->link('Past Orders', array('action' => 'overview_past_orders', $current_user['id']))?></li> 
     <li><?php echo $this->Html->link('Blog Pages', array('action' => 'overview_blog_pages', $current_user['id']))?></li> 
     <li><?php echo $this->Html->link('Chextands', array('action' => 'overview_chextands', $current_user['id']))?></li> 


    </ul> 
</div> 

每次我点击标签代码,整个页面各个选项卡内呈现。有没有办法在我的.ctp文件中渲染视图?

回答

1

设置这些行动的布局是“AJAX”:

$this->layout = 'ajax'; 

这样,你不加载选项卡里面的整个布局。

必须在相应的操作

+0

为此在控制器当我补充说,为的动作,整个页面变为空白的布局,而不仅仅是标签 –

+0

内你有一个ajax.ctp布局?创建一个名为'ajax.ctp'的布局文件,并在其中放入:'<?php echo $ content_for_layout; ?> –

+0

是的,我确实有这样的布局 –