Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/redis/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
添加一个<;链接rel=";图像“u src”&燃气轮机;在我的joomla模板中_Joomla_Joomla1.5 - Fatal编程技术网

添加一个<;链接rel=";图像“u src”&燃气轮机;在我的joomla模板中

添加一个<;链接rel=";图像“u src”&燃气轮机;在我的joomla模板中,joomla,joomla1.5,Joomla,Joomla1.5,我是Joomla 1.5网站的管理员。我今天遇到了一个问题,因为当我在Facebook上分享一篇文章时,它没有显示图像。搜索互联网时,我发现Facebook需要在html页面的标题中添加链接标签,如下所示: <link rel="image_src" href="..." /> 因此,我修改了主模板的index.php文件,在标题中添加了以下标记: <link rel="image_src" href="<?php echo JURI::base() . $this-&

我是Joomla 1.5网站的管理员。我今天遇到了一个问题,因为当我在Facebook上分享一篇文章时,它没有显示图像。搜索互联网时,我发现Facebook需要在html页面的标题中添加链接标签,如下所示:

<link rel="image_src" href="..." />
因此,我修改了主模板的index.php文件,在标题中添加了以下标记:

<link rel="image_src" href="<?php echo JURI::base() . $this->item->image; ?>" />

$这是指插件的上下文,而在模板$中,这是模板,因此是错误

我在很长一段时间内都没有使用过1.5,但是考虑到系统插件可以访问生成的标记;因此它可以插入任何操纵html文本的标记

但是,它需要访问组件的数据才能获得图像。但是组件在插件之前运行,因此可以在组件中设置post var或全局:

JRequest::setVar('templateheader',$this->item->image);

然后在系统插件或库/joomla/document/html/renderer/head.php(core hack)中检索并打印出来。

他们也可以使用
JRequest::getVar('templateheader')在模板中获取它
<link rel="image_src" href="<?php echo JURI::base() . $this->item->image; ?>" />
JRequest::setVar('templateheader',$this->item->image);