如何在magento中使用自定义变量获取元描述

问题描述 投票:0回答:1

我是 magento 的新手,所以如果我的问题很愚蠢,我深表歉意。

我需要在页面顶部的带有自定义变量的块中显示元描述。这可能吗?

我四处寻找,我认为这篇文章是我应该做的。但我无法让它发挥作用。 帖子链接

这是我在“变量 HTML 值”字段中写的内容:

< ?php $descr = $this->getLayout()->getBlock('head')->getDescription() ; 回显 $descr; ?>

php magento
1个回答
0
投票

<?php $headBlock = $this->getLayout()->getBlock('head'); echo $description=$headBlock->getDescription(); ?>
请使用此代码

© www.soinside.com 2019 - 2024. All rights reserved.