<?= h($this->fetch('title')) ?>タイトルは、fetchメソッドを使い、titleという値を出力しています。ページのタイトルは、このように取得します。
echo $this->fetch('meta');ヘッダーでは、<meta>タグやCSS、スクリプトなどのタグを自動出力するための処理が用意されてます。これらは、CakePHP3のシステムの状況などに応じて必要なタグを出力します。
echo $this->fetch('css');
echo $this->fetch('script');
<?= $this->fetch('content') ?>コンテンツは、fetchメソッドを使い、contentという項目の値として取り出し出力します。これで、読み込んだテンプレートのレンダリング結果がここに書きだされます。
※リストが表示されない場合
AddBlockなどの広告ブロックツールがONになっているとリストなどが表示されない場合があります。これらのツールをOFFにしてみてください。
<!DOCTYPE html> <html lang="en"> <head> <title><?= h($this->fetch('title')) ?></title> <link rel="shortcut icon" href="favicon.ico" type="image/x-icon"> <?php echo $this->fetch('meta'); echo $this->fetch('css'); echo $this->fetch('script'); ?> </head> <body> <div id="header"> <div id="menu">...</div> </div> <?= $this->fetch('content') ?> <div id="footer">...</div> </body> </html>
<< 前へ | 次へ >> |