XF 2.2 Rating macro on custom page

Andy.N

Well-known member
I'm trying to show a hard code star rating on a page using this code
Code:
<xf:macro template="rating_macros" name="stars_text"
                    arg-rating="{$resource.rating_avg}"
                    arg-count="{$resource.rating_count}"
                    arg-rowClass="ratingStarsRow--justified"
                     />    

    <span class="ratingStars " title="4.91 star(s)">
        <span class="ratingStars-star ratingStars-star--full"></span>
        <span class="ratingStars-star ratingStars-star--full"></span>
        <span class="ratingStars-star ratingStars-star--full"></span>
        <span class="ratingStars-star ratingStars-star--full"></span>
        <span class="ratingStars-star ratingStars-star--half"></span>
        <span class="u-srOnly">4.91 star(s)</span>
    </span>

        <span class="ratingStarsRow-text">
            22 reviews
        </span>
This is the result
Screenshot 2023-02-25 at 11.29.57 PM.webp

How do I get rid of the first row of zero star?
 
Here is one that works
Code:
<xf:set var="$extraData">
    <xf:macro template="rating_macros" name="rating" />    
</xf:set>

    
    <span class="ratingStars" style="font-size: 100% !important;" title="4.91 star(s)">
        <span class="ratingStars-star ratingStars-star--full"></span>
        <span class="ratingStars-star ratingStars-star--full"></span>
        <span class="ratingStars-star ratingStars-star--full"></span>
        <span class="ratingStars-star ratingStars-star--full"></span>
        <span class="ratingStars-star ratingStars-star--half"></span>
        <span class="u-srOnly">4.91 star(s)</span>
    </span>

        <span class="ratingStarsRow-text">
            22 reviews
        </span>
 
Back
Top Bottom