如何更改Extravote.php的放置结构标记

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

我有一个Joomla网站。需要在extravote.php中添加Google结构化数据。

这是源代码:

$html="
<div class=\"extravote-container".$stars."\"".( $xid != 'x' ? "" : " style=\"margin-top:5px;\"" ).">
  <ul class=\"extravote-stars".$stars."\">
    <li id=\"rating_".$id."_".$xid."\" class=\"current-rating\" style=\"width:".(int)$percent."%;\"></li>
    <li><a href=\"javascript:void(null)\" onclick=\"javascript:JVXVote(".$id.",1,".$rating_sum.",".$rating_count.",'".$xid."',".$counter.");\" title=\"".JTEXT::_('Very Poor')."\" class=\"ev-one-star\">1</a></li>
    <li><a href=\"javascript:void(null)\" onclick=\"javascript:JVXVote(".$id.",2,".$rating_sum.",".$rating_count.",'".$xid."',".$counter.");\" title=\"".JTEXT::_('Poor')."\" class=\"ev-two-stars\">2</a></li>
    <li><a href=\"javascript:void(null)\" onclick=\"javascript:JVXVote(".$id.",3,".$rating_sum.",".$rating_count.",'".$xid."',".$counter.");\" title=\"".JTEXT::_('Regular')."\" class=\"ev-three-stars\">3</a></li>
    <li><a href=\"javascript:void(null)\" onclick=\"javascript:JVXVote(".$id.",4,".$rating_sum.",".$rating_count.",'".$xid."',".$counter.");\" title=\"".JTEXT::_('Good')."\" class=\"ev-four-stars\">4</a></li>
    <li><a href=\"javascript:void(null)\" onclick=\"javascript:JVXVote(".$id.",5,".$rating_sum.",".$rating_count.",'".$xid."',".$counter.");\" title=\"".JTEXT::_('Very Good')."\" class=\"ev-five-stars\">5</a></li>
  </ul>
</div><div class=\"extravote-aggregate\">
<div>
  <span id=\"extravote_".$id."_".$xid."\" class=\"extravote-count\"><small>
<div>";

这些是我要添加的更改:

<div itemscope itemtype=\"http://schema.org/Organization\">
<span itemprop=\"name\" content=\"<?php echo $this->escape($this->item->title); ?>\">
  <span id=\"extravote_".$id."_".$xid."\" class=\"extravote-count\"><small>
<div itemprop=\"aggregateRating\"
    itemscope itemtype=\"https://schema.org/AggregateRating\">";

但是此笔划无效:

<span itemprop=\"name\" content=\"<?php echo $this->escape($this->item->title); ?>\">

我想从Joomla的Microdata文章中获得标题。请告诉我如何使这段代码起作用?

structure markup microdata
1个回答
0
投票

现在我选择了非常简单的变体:

<div class=\"extravote-aggregate\">
<div itemscope itemtype=\"http://schema.org/Organization\">
<span itemprop=\"name\" content=\"text\">
  <span id=\"extravote_".$id."_".$xid."\" class=\"extravote-count\"><small>
<div itemprop=\"aggregateRating\"
    itemscope itemtype=\"https://schema.org/AggregateRating\">";

Google结构化数据验证器未显示错误。但是我认为它不是真正的变体。

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