我只是新的CakePhp,我想知道如何在另一个视图中调用视图.
当我开始运行CakePhp时,默认布局位于view / layouts / default.ctp中.
在default.ctp中,我调用了一个视图名称homeview(view / homes / homeview.ctp).
这是我的代码:
echo $this->fetch('homeview'); // this statement here is work
?>
在homeview.ctp中我调用了另一个名为displayphone的视图(view / homes / displayphone.ctp)
homeview.ctp
<?php $this->start('homeview'); ?>
This is home view
<?php echo $this->fetch('displayphone'); // this statement does not work; ?>
<?php $this->end(); ?>
displayphone.ctp
<?php $this->start('displayphone');?>
This page display phone
<?php $this->end(); ?>
为什么我不能在homeview中调用displayphone block?