Редактор темы

Вопрос? Как сделать shema рейтинг разметки под 3й тип оценки dle?

Voldigoad

PRO Users
Регистрация
19 Сен 2019
Сообщения
157
Рейтинг реакций
13
Баллы
18
1/3
Автор темы
Добрый вечер товарищи.
У меня 3й тип рейтинга новостей (Нравится или Не нравится)
и 10и бальная система рейтинга 🙂
И как сие чудо упаковать в shem'y разметку рейтинга? Чтобы на выходе в гугле было как здесь:Снимок.PNG

Код fullstory.tpl прилагаю:

Код:
[rating-type-3]
                            <div class="fx-row fx-middle fx-start">
                                <span class="rating-vgs">{rating}{vote-num}</span>
                                <div class="rate-full fx-row" id="rate-{news-id}" data-id="{news-id}">
                                    <div class="ratefull-plus" onclick="doRateLD('plus', '{news-id}');"><span class="fa fa-thumbs-up"></span></div>
                                    <div class="ratefull-minus" onclick="doRateLD('minus', '{news-id}');"><span class="fa fa-thumbs-down"></span></div>
                                    <div class="ratefull-hide">{rating}{vote-num}</div>
                                </div>
                                <div class="rating-votenote"> Голосов: {vote-num}</div>
                            </div>
                            [/rating-type-3]
 
Автор темы
Поправка: Сделал разметки по инструкции от сюда клик
НО, у меня как-то неправильно выводит, если у новости рейтинг 9.5, то гугл валидатор выдает 9.1 🙁
С чем это связано, как решить?
Вот код рейтинга из engine/modules/functions.php
Код:
function ShowRating($id, $rating, $vote_num, $allow = true) {
    global $lang, $config, $row, $dle_module;

    if( !$config['rating_type'] ) {
        
        if( $rating AND $vote_num ) $rating = round( ($rating / $vote_num), 0 );
        else $rating = 0;
        
        if ($rating < 0 ) $rating = 0;
        
        if ($vote_num AND $dle_module == "showfull") {
            
            $shema_title = " itemprop=\"aggregateRating\" itemscope itemtype=\"http://schema.org/AggregateRating\"";
            $shema_ratig = $rating;
            $shema_ratig_title = str_replace("&amp;amp;", "&amp;",  htmlspecialchars( strip_tags( stripslashes( $row['title'] ) ), ENT_QUOTES, $config['charset'] ) );
            $shema = "<meta itemprop=\"itemReviewed\" content=\"{$shema_ratig_title}\"><meta itemprop=\"worstRating\" content=\"1\"><meta itemprop=\"ratingCount\" content=\"{$vote_num}\"><meta itemprop=\"ratingValue\" content=\"{$shema_ratig}\"><meta itemprop=\"bestRating\" content=\"5\">";

        } else {
            $shema_title = "";
            $shema = "";
        }
        
        $rating = $rating * 20;
    
        if( !$allow ) {
        
            $rated = <<<HTML
<div class="rating"{$shema_title}>
        <ul class="unit-rating">
        <li class="current-rating" style="width:{$rating}%;">{$rating}</li>
        </ul>{$shema}
</div>
HTML;
        
            return $rated;
        }
    
        $rated = <<<HTML
<div id='ratig-layer-{$id}'>
    <div class="rating"{$shema_title}>
        <ul class="unit-rating">
        <li class="current-rating" style="width:{$rating}%;">{$rating}</li>
        <li><a href="#" title="{$lang['useless']}" class="r1-unit" onclick="doRate('1', '{$id}'); return false;">1</a></li>
        <li><a href="#" title="{$lang['poor']}" class="r2-unit" onclick="doRate('2', '{$id}'); return false;">2</a></li>
        <li><a href="#" title="{$lang['fair']}" class="r3-unit" onclick="doRate('3', '{$id}'); return false;">3</a></li>
        <li><a href="#" title="{$lang['good']}" class="r4-unit" onclick="doRate('4', '{$id}'); return false;">4</a></li>
        <li><a href="#" title="{$lang['excellent']}" class="r5-unit" onclick="doRate('5', '{$id}'); return false;">5</a></li>
        </ul>{$shema}
    </div>
</div>
HTML;
    
        return $rated;

    } elseif ($config['rating_type'] == "1") {
        
        if( $rating < 0 ) $rating = 0;
        
        if( $allow ) $rated = "<span id=\"ratig-layer-{$id}\" class=\"ignore-select\"><span class=\"ratingtypeplus ignore-select\" >{$rating}</span></span>";
        else $rated = "<span class=\"ratingtypeplus ignore-select\" >{$rating}</span>";
        
        return $rated;
    
    } elseif ($config['rating_type'] == "2" OR $config['rating_type'] == "3") {
        
        $extraclass = "ratingzero";
        
        if( $rating < 0 ) {
            $extraclass = "ratingminus";
        }
        
        if( $rating > 0 ) {
            $extraclass = "ratingplus";
            $rating = "+".$rating;
        }
        
        if( $allow ) $rated = "<span id=\"ratig-layer-{$id}\" class=\"ignore-select\"><span class=\"ratingtypeplusminus ignore-select {$extraclass}\" >{$rating}</span></span>";
        else $rated = "<span class=\"ratingtypeplusminus ignore-select {$extraclass}\" >{$rating}</span>";
        
        return $rated;
        
    }
 
Автор темы
UP, Ребят ну помогите пожалуйста!!!
 

Похожие темы Последние темы Популярные темы

Назад
Сверху