Icy Phoenix

     
 


Post new topic  Reply to topic 
Page 1 of 1
 
 
Reply with quote Download Post
Post [Quality Points MOD] About PHPbb Loopings Once Again 
 
Hi to all again:

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:

Code: [Download] [Hide] [Select]
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)


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.
 



 
SarakinSend private message  
Back to topPage bottom
Icy Phoenix is an open source project, you can show your appreciation and support future development by donating to the project.

Support us
 
Post new topic  Reply to topic  Page 1 of 1
 


Display posts from previous:    

HideWas this topic useful?

Link this topic
URL
BBCode
HTML




 
Permissions List
You cannot post new topics
You cannot reply to topics
You cannot edit your posts
You cannot delete your posts
You cannot vote in polls
You cannot attach files
You can download files
You cannot post calendar events


  

 

  cron