Php 如何使用我的描述(元描述)作为joomla2.5中的第二个标题
我想在joomla 2.5.x中使用文章描述部分元描述作为第二个标题 并把它放在文章标题旁边 为此,我使用以下命令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提供的答案从评
<?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>";