https://www.icyphoenix.com/viewtopic.php?f=35&t=4937 ----------------------------------- OwnageWorld Tue 21 Oct, 2008 20:12 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! ----------------------------------- OwnageWorld Wed 08 Apr, 2009 20:49 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! :loveit: ----------------------------------- novice programmer Sat 11 Apr, 2009 16:30 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. ----------------------------------- OwnageWorld Sun 12 Apr, 2009 11:38 Re: New Blocks: Highest Rated Topics/ Most Read Topics ----------------------------------- [quote user="novice programmer" post="38259"]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.[/quote] In theory this sounds very good :loveit: 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 linenumbers=false][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.[/code] I'm willing to pay money for anyone who is able to make this... Thanks in advance ----------------------------------- FedericoBiccheddu Sun 12 Apr, 2009 17:01 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 linenumbers=false]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'] . '&' . POST_TOPIC_URL . '=' . $recent_topic_row[$i]['topic_id'] . '&' . POST_POST_URL . '=' . $recent_topic_row[$i]['post_id']) . '#p' . $recent_topic_row[$i]['post_id'], 'L_TITLE' => $topic_title, ) ); } ?> [/code] The .tpl: [code linenumbers=false]
[/code] 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 ;) [size=10]Sorry for my bad English :oops: [/size] ----------------------------------- novice programmer Sun 19 Apr, 2009 14:13 Re: New Blocks: Highest Rated Topics/ Most Read Topics ----------------------------------- lokking at [b]FedericoBiccheddu[/b] post, it appers to be right for this matter. BTW, it should no have a require to common.php? ----------------------------------- FedericoBiccheddu Sun 19 Apr, 2009 14:51 Re: New Blocks: Highest Rated Topics/ Most Read Topics ----------------------------------- [quote user="novice programmer" post="38550"]lokking at [b]FedericoBiccheddu[/b] post, it appers to be right for this matter. BTW, it should no have a require to common.php?[/quote] 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. ;)