私はこれとこれを読みました。しかし、私は答えを見つけることができませんでした。
アクションのビューが存在するこのファイルがあります: 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'); ?>
ありがとうございました