Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/joomla/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
Php 如何使用我的描述(元描述)作为joomla2.5中的第二个标题_Php_Joomla - Fatal编程技术网

Php 如何使用我的描述(元描述)作为joomla2.5中的第二个标题

Php 如何使用我的描述(元描述)作为joomla2.5中的第二个标题,php,joomla,Php,Joomla,我想在joomla 2.5.x中使用文章描述部分元描述作为第二个标题 并把它放在文章标题旁边 为此,我使用以下命令 <?php jimport( 'joomla.document.document' ); function getDescription() { return $this->description; } echo "<h3>".getDescription()."</h3>"; ?> 我将@hhgh4269提供的答案从评

我想在joomla 2.5.x中使用文章描述部分元描述作为第二个标题

并把它放在文章标题旁边

为此,我使用以下命令

<?php 

jimport( 'joomla.document.document' );

function getDescription() {
    return $this->description;
}

echo "<h3>".getDescription()."</h3>";

?>

我将@hhgh4269提供的答案从评论中提取出来,并作为一个答案,以帮助未来的访问者了解这个问题

这与最初提出的问题略有不同。相反,它是使用以下方法完成的:

$doc =JFactory::getDocument(); 
$meta_description = $doc->getMetaData("description"); 
echo "<h3>".$meta_description."</h3>";

我还没有测试,但您可能只需要回显$this->item->metadesc;。非常感谢。我找到了另一种方法。$doc=JFactory::getDocument$meta_description=$doc->getMetaDatadescription;回声。$meta_描述。;
$doc =JFactory::getDocument(); 
$meta_description = $doc->getMetaData("description"); 
echo "<h3>".$meta_description."</h3>";