How to change value of $ratingvotesav in showthread ?
#1
Hello,

I'm coding my own plugin.

I want to create a rating rich snippet in specific post/forum.

Here is the code of my plugin:

	function rating_snippet(&$thread)
{
	if($thread['numratings'] > 0)
	{
		$offer_name = $thread['subject'];
		$offer_rating = $thread['averagerating'];
		$offer_count = $thread['numratings'];
		$ratingvotesav = "<div itemprop=\"aggregateRating\" itemscope itemtype=\"http://schema.org/AggregateRating\">
			<div>Rating : 
			  <span itemprop=\"ratingValue\">" . $offer_rating . "</span>/
			  <span itemprop=\"bestRating\">5</span>
			  (<span itemprop=\"ratingCount\">" . $offer_count . "</span> vote(s))
			</div>
		  </div>";
	}
}

Since it's currently local, of course value $ratingvotesav is not update in showthread.

I tried to put $ratingvotesav in method call (function rating_snippet(&$thread, &$ratingvotesav) ) but it's not working.

Any idea ?

Another solution to my problem could be to dynamically change template from "showthread_ratethread" to "showthread_ratethread_with_snippet" in my plugin, but I don't know if it is possible, and how to do this...
Reply


Messages In This Thread
How to change value of $ratingvotesav in showthread ? - by Goose - 2015-06-06, 04:02 PM

Forum Jump:


Users browsing this thread: 1 Guest(s)