我想问,是否有办法从视图文件中分配元描述标记?我知道,我的.ctp文件中的代码运行良好:
// Assign title tag
$this->assign('title','Page title);我试过:
$this->Html->assing('description','description']);但没有成功。
或者,如果这是不可能的,如何设置元描述,而不是从布局?这是可行的,但只适用于布局视图文件:
<?= $this->Html->meta(
'description',
'enter any meta description here'
);?>发布于 2015-07-16 20:49:07
使用block选项作为meta()函数(meta)
<?php $this->Html->meta(
'description',
'enter any meta description here',
['block' => 'meta']
);?>然后在布局中回显meta块:
<?= $this->fetch('meta'); ?>https://stackoverflow.com/questions/31450768
复制相似问题