我有这个文件,其中存在我的操作视图: View/MyController/index.ctp
我也有这个文件 View/Commons/blocks.ctp
Blocks.ctp文件包括以下内容:
$this->start('sidebar1');
echo 'Some content';
$this->end();
$this->start('sidebar2');
echo 'Some content more';
$this->end();
所以在“ index.ctp ”文件中我想获取sidebar1或sidebar2。我怎样才能做到这一点?我把它写到index.ctp,但没有用。
<?php echo $this->fetch('sidebar1'); ?>
这个也没用
<?php echo $this->fetch('../View/Commons/blocks.ctp/sidebar1'); ?>
谢谢