Icy Phoenix

     
 


Post new topic  Reply to topic 
Page 1 of 1
 
 
Reply with quote Download Post 
Post New Blocks: Highest Rated Topics/ Most Read Topics 
 
Hey all,

I want to make 2 new blocks:
- highest rated topics
- most read topics

Does anybody know how I should make these?

Thnx in advance!
 



 
OwnageWorldSend 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
 
Reply with quote Download Post 
Post Re: New Blocks: Highest Rated Topics/ Most Read Topics 
 
Nobody got a solution for me?
I would like to have this for RC1 if possible!

And could someone take a look at the recent topics from certain forum?
Or could someone point me in the right direction?

Lotsa questions, sorry for that....

Thnx in advance!  
 



 
OwnageWorldSend private message  
Back to topPage bottom
Reply with quote Download Post 
Post Re: New Blocks: Highest Rated Topics/ Most Read Topics 
 
Just two php queries:

one for the average rate or the maximun one or the # of rates

for the second, the number of views of the thread.
 



 
novice programmerSend private message  
Back to topPage bottom
Reply with quote Download Post 
Post Re: New Blocks: Highest Rated Topics/ Most Read Topics 
 
novice programmer wrote: [View Post]
Just two php queries:

one for the average rate or the maximun one or the # of rates

for the second, the number of views of the thread.

In theory this sounds very good  
But if I change the recent topics block, for example to sort it on something else, I get some nice looking errors...

I was hoping a thread could be made, were one could share all sorts of blocks.

Ultimately I would like to have a block like this:

Code: [Download] [Hide] [Select]
[Populair]   [recent]     [Best rated]    

This week:  
1.
2.
3.
4.
5.

This month:
1.
2.
3.
4.
5.

All time:
1.
2.
3.
4.
5.


I'm willing to pay money for anyone who is able to make this...

Thanks in advance
 



 
OwnageWorldSend private message  
Back to topPage bottom
Reply with quote Download Post 
Post Re: New Blocks: Highest Rated Topics/ Most Read Topics 
 
It creates a block in php that it executes this query, and will show 5 more seen:

Code: [Download] [Hide] [Select]
<?php
$except_forums = build_exclusion_forums_list();

$sql = "SELECT t.* FROM " . TOPICS_TABLE . " AS t NOT IN (" . $except_forums . ") ORDER BY t.topic_views DESC LIMIT  0, 5";

if (!$result = $db->sql_query($sql))
{
   message_die(GENERAL_ERROR, 'Could not query most view topics information', '', __LINE__, __FILE__, $sql);
}
$number_topics = $db->sql_numrows($result);
$topic_row = array();
while ($row = $db->sql_fetchrow($result))
{
   $topic_row[] = $row;
}

for ($i = 0; $i < $number_topics; $i++)
{
   $orig_word = array();
   $replacement_word = array();
   obtain_word_list($orig_word, $replacement_word);

   if (!empty($orig_word))
   {
       $recent_topic_row[$i]['topic_title'] = (!empty($recent_topic_row[$i]['topic_title'])) ? preg_replace($orig_word, $replacement_word, $recent_topic_row[$i]['topic_title']) : '';
   }

   $topic_title = htmlspecialchars_clean($recent_topic_row[$i]['topic_title']);
   $template->assign_block_vars('most_view_topic', array(
       'U_TITLE' => append_sid(VIEWTOPIC_MG . '?' . POST_FORUM_URL . '=' . $recent_topic_row[$i]['forum_id'] . '&amp;' . POST_TOPIC_URL . '=' . $recent_topic_row[$i]['topic_id'] . '&amp;' . POST_POST_URL . '=' . $recent_topic_row[$i]['post_id']) . '#p' . $recent_topic_row[$i]['post_id'],
       'L_TITLE' => $topic_title,
       )
   );
}
?>


The .tpl:
Code: [Download] [Hide] [Select]
<table class="empty-table" width="100%" cellspacing="0" cellpadding="0" border="0">
<tr>
<td align="left">
<ul>
<!-- BEGIN most_view_topic -->
<li><a href="{most_view_topics.U_TITLE}" title="{most_view_topics.L_TITLE}">{most_view_topics.L_TITLE}</a>
<!-- END most_view_topic -->
</ul>
</td>
</tr>
</table>


it is a thing thrown on the moment, I do not know if it works, but trying a little, you would have to succeed to us, same thing for the others. Enough that orders for the other fields that you want


Sorry for my bad English  
 




____________
Host Server: Linux (Aruba)
IP Version: 1.3.1.54 Modded
IP WebSite: MakingART (Web 2.0)
 
FedericoBicchedduSend private messageVisit poster's website  
Back to topPage bottom
Reply with quote Download Post 
Post Re: New Blocks: Highest Rated Topics/ Most Read Topics 
 
lokking at FedericoBiccheddu post, it appers to be right for this matter.

BTW, it should no have a require to common.php?
 



 
novice programmerSend private message  
Back to topPage bottom
Reply with quote Download Post 
Post Re: New Blocks: Highest Rated Topics/ Most Read Topics 
 
novice programmer wrote: [View Post]
lokking at FedericoBiccheddu post, it appers to be right for this matter.

BTW, it should no have a require to common.php?


Obviously. Mine it was an example, the tag have been puttinges for habit I always write, them in a not complete script also in the forum. enough to implement it in the creation of a new block.


 




____________
Host Server: Linux (Aruba)
IP Version: 1.3.1.54 Modded
IP WebSite: MakingART (Web 2.0)
 
FedericoBicchedduSend private messageVisit poster's website  
Back to topPage bottom
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