What we pretend to achieve now is a little different, but we still miss on the Looping things ( <!-- BEGIN loop loop END--> ). The idea here is giving Quality Points to certain Topics, in order to show "official" Ratings from the site team. This Quality points (QP's in advance) would be showed on the forum topics list, just aside of the topic title, or maybe on a new block which shows a list of the best Topics with higher Quality Points. The fact is we need a numeric value stored in an Icy variable, and we want to execute an order through a Looping as many times as the previous numeric value tells, for example in this case, in order to print as many times as we want a single star picture.
So, we need an own table, called ip_topic_vip, which have three fields:
ID -> Inner identifier for our table
Topic -> The ID of the Topic.
Valoracion -> The Rating we've given to this Topic
In constants.php we've defined the variable SPOST_USER_TABLE with the name of the table ip_topic_vip, so we can call it later on many files as we need.
After that we should modify the viewforum.php, in order to make the Looping which should walk over every Topic in the selected forum:
if( $total_topics )
{
for($i = 0; $i < $total_topics; $i++)
{
//We set on our rating variable in order to avoid that other Topics might be filled with other ratings than the own ones:
$valoracion = '';
//We make our SQL query:
$sql = "SELECT `valoracion`
FROM " . SPOST_USER_TABLE . "
WHERE topic = '" . $topic_id . "'";
//We execute the query:
if(!$result = $db->sql_query($sql))
{
message_die(GENERAL_ERROR, "Error getting valoracion information", "", __LINE__, __FILE__, $sql);
}
//We store the value we've got (the Topic official Rating):
while ($row = $db->sql_fetchrow($result))
{
$valoracion = $row['valoracion'];
}
//After that, we find this:
$template->assign_block_vars('topicrow', array(
And we add our value:
'VALORACION' => $valoracion, //Added by Krator (Special post)
{
for($i = 0; $i < $total_topics; $i++)
{
//We set on our rating variable in order to avoid that other Topics might be filled with other ratings than the own ones:
$valoracion = '';
//We make our SQL query:
$sql = "SELECT `valoracion`
FROM " . SPOST_USER_TABLE . "
WHERE topic = '" . $topic_id . "'";
//We execute the query:
if(!$result = $db->sql_query($sql))
{
message_die(GENERAL_ERROR, "Error getting valoracion information", "", __LINE__, __FILE__, $sql);
}
//We store the value we've got (the Topic official Rating):
while ($row = $db->sql_fetchrow($result))
{
$valoracion = $row['valoracion'];
}
//After that, we find this:
$template->assign_block_vars('topicrow', array(
And we add our value:
'VALORACION' => $valoracion, //Added by Krator (Special post)
Well, now we have to modify the viewforum_body.tpl template file. So, what we need now it's to make a Looping which repeat as many times as we wish a certain orden, as I said earlier, for instance in order to print a single image X times ( <img src="star.gif"> ). What we don't know is... HOW to do this?
Thanks for your attention in advance. Greetings to all and merry christmas.