Php 如何在“中添加内容”&书信电报;头>&引用;使用Drupal7.x?
我很怀疑。。。我添加内容的方式是否正确(例如发布者google plus的链接、元标记或外部资源css): 我希望你能帮助我:)对不起我的英语 编辑我问这个问题也是因为这些是我最新的更改,现在我注意到,如果我用Php 如何在“中添加内容”&书信电报;头>&引用;使用Drupal7.x?,php,drupal,drupal-7,head,Php,Drupal,Drupal 7,Head,我很怀疑。。。我添加内容的方式是否正确(例如发布者google plus的链接、元标记或外部资源css): 我希望你能帮助我:)对不起我的英语 编辑我问这个问题也是因为这些是我最新的更改,现在我注意到,如果我用Firefox登录并查看我的网站,就不会出现CSS!荒谬 现在我有3种方法: 如何在标题中添加内容不正确 发布Firefox(44.0.2) 问题模块高级CSS/JS聚合 编辑2.0这是firefox的一个问题(我重置了它,问题就解决了)。。。但是,我想知道这种添加head的方法是否正确;
Firefox
登录并查看我的网站,就不会出现CSS!荒谬
现在我有3种方法:
标题中添加内容不正确
编辑2.0这是firefox的一个问题(我重置了它,问题就解决了)。。。但是,我想知道这种添加
head
的方法是否正确;) drupal\u add\u html\u head将输出添加到html页面的head标记。只要不发送头,就可以调用此函数
更多信息,请访问drupal\u add\u html\u head,将输出添加到html页面的head标记中。只要不发送头,就可以调用此函数
更多信息请访问我找到的最简单的方法是在我的template.php中删除以下内容
function THEMENAME_preprocess_html(&$variables) {
if(drupal_is_front_page()) {
$meta_description = array(
'#type' => 'html_tag',
'#tag' => 'meta',
'#attributes' => array(
'name' => 'description',
'content' => 'blah blah blah'
)
);
$meta_keywords = array(
'#type' => 'html_tag',
'#tag' => 'meta',
'#attributes' => array(
'name' => 'keywords',
'content' => 'some, keywords'
)
);
drupal_add_html_head( $meta_description, 'meta_description' );
//drupal_add_html_head( $meta_keywords, 'meta_keywords' );
drupal_add_html_head_link(array(
'rel' => 'publisher',
'href' => 'https://plus.google.com/xxxxxxxxx',
));
}
}
Publisher只在首页上需要,因此drupal是首页我发现的最简单的方法是在我的template.php中删除以下内容
function THEMENAME_preprocess_html(&$variables) {
if(drupal_is_front_page()) {
$meta_description = array(
'#type' => 'html_tag',
'#tag' => 'meta',
'#attributes' => array(
'name' => 'description',
'content' => 'blah blah blah'
)
);
$meta_keywords = array(
'#type' => 'html_tag',
'#tag' => 'meta',
'#attributes' => array(
'name' => 'keywords',
'content' => 'some, keywords'
)
);
drupal_add_html_head( $meta_description, 'meta_description' );
//drupal_add_html_head( $meta_keywords, 'meta_keywords' );
drupal_add_html_head_link(array(
'rel' => 'publisher',
'href' => 'https://plus.google.com/xxxxxxxxx',
));
}
}
Publisher只在首页上才需要,因此drupal_是首页,但对我的代码来说是正确的,drupal_add_html_head in function mysubtheme_page_alter($page)?只要不发送标题,就可以调用此函数。尝试将代码移动到自定义模块中(可能是hook_init)。感谢您的反馈,但这是对的,我的代码,使用drupal\u add\u html\u head函数mysubtheme\u page\u alter($page)?只要不发送头,就可以调用此函数。尝试将代码移动到自定义模块中(可能是hook_init)。谢谢你的反馈,如果也被添加到网站的其他页面?是否是一个问题?是否也添加到网站的其他页面?这是一个问题吗?