Author |
Message |
Holger Board Member
Joined: 19 Jan 2009
Posts: 509 Location: Hanover
|
Posted: Tue Mar 23, 2010 4:35 am Post subject: Top 10 markup |
|
|
Hi,
I would like to mark up the top 10 active topics in viewforum and in the search-result.
Is that possible?
/Holger |
|
Back to top |
|
|
Holger Board Member
Joined: 19 Jan 2009
Posts: 509 Location: Hanover
|
Posted: Wed Jun 02, 2010 4:09 am Post subject: Re: Top 10 markup |
|
|
Nobody? |
|
Back to top |
|
|
Salvatos Board Member
Joined: 19 Feb 2009
Posts: 449 Location: Québec
|
Posted: Wed Jun 02, 2010 11:31 am Post subject: Re: Top 10 markup |
|
|
Doesn't sound too hard, but I don't actually know what you mean
Can you explain or give an example, please? |
|
Back to top |
|
|
Holger Board Member
Joined: 19 Jan 2009
Posts: 509 Location: Hanover
|
Posted: Wed Jun 02, 2010 1:38 pm Post subject: Re: Top 10 markup |
|
|
I would like to mark up the 10 most active topics with a star or something ...
When clicking on the STAR I get to a list with the most active topics. |
|
Back to top |
|
|
Salvatos Board Member
Joined: 19 Feb 2009
Posts: 449 Location: Québec
|
Posted: Wed Jun 02, 2010 5:55 pm Post subject: Re: Top 10 markup |
|
|
Hm, so when you go to viewforum, these ten would appear first or they would just have the star added? The way I see it, you would have to make a query searching for the number of posts in every topic (in that forum only, possibly) and making a top ten, then check for every topic displayed in the page if it's part of those. If so, add the star, otherwise skip to the next.
I can't really get involved in that much code at the moment, though, and I'm not too familiar with this area of phpBB2.
The query should look like SELECT topic FROM table WHERE forum = this_one ORDER BY post_count DESC LIMIT 10, I think. But I don't know the names of all the tables and columns and I'm not even sure there is a "post_count" entry in the topics' table...
Then you could check, in viewforum, where the topics are inserted into the page, if whatever variable they use to identify them is found in the array returned by the query, and add the star accordingly. |
|
Back to top |
|
|
Holger Board Member
Joined: 19 Jan 2009
Posts: 509 Location: Hanover
|
Posted: Thu Jun 03, 2010 2:37 am Post subject: Re: Top 10 markup |
|
|
Quote: | ... or they would just have the star added? |
Exactly!
Thank you for helping me going in the right direction!
Yes, they should be marked with a star in viewforum and in viewtopic.
Does anybody know if there is a possibility to calculate the activity? |
|
Back to top |
|
|
Salvatos Board Member
Joined: 19 Feb 2009
Posts: 449 Location: Québec
|
Posted: Thu Jun 03, 2010 12:45 pm Post subject: Re: Top 10 markup |
|
|
As I can see, forum_topic has the topic_views and topic_replies columns that could be used. You could just pick the highest value from one of these (or both), depending on your personal definition of "active".
This table also has a forum_id column, as I suspected, which is perfect for what you're trying to do. My SQL is a bit rusted, but you should be able to use something pretty close to this: SELECT topic_id FROM forum_topics WHERE forum_id = '$forum_id' ORDER BY topic_replies DESC LIMIT 10
The rest isn't going to be too easy, though. You'll have to have a good look through viewforum.php, check how they handle topics and display them. You'll probably need exceptions for announcements (which are shown on every page) and forums that have less than 10 topics.
Good luck!
Edit: I just saw you want the star in viewtopic.php as well. This one should be easier, since you just have to run the query and display the star where you want if this topic_id is part of the results. |
|
Back to top |
|
|
Holger Board Member
Joined: 19 Jan 2009
Posts: 509 Location: Hanover
|
Posted: Fri Jun 04, 2010 2:41 am Post subject: Re: Top 10 markup |
|
|
Thank you so much Salvatos! I will give it a try! |
|
Back to top |
|
|
Dog Cow Board Member
Joined: 18 Nov 2008
Posts: 378
|
|
Back to top |
|
|
Holger Board Member
Joined: 19 Jan 2009
Posts: 509 Location: Hanover
|
Posted: Tue Jun 15, 2010 2:13 pm Post subject: Re: Top 10 markup |
|
|
Whooo-hoooo! That looks nice! |
|
Back to top |
|
|
Holger Board Member
Joined: 19 Jan 2009
Posts: 509 Location: Hanover
|
Posted: Wed Jun 16, 2010 5:10 am Post subject: Re: Top 10 markup |
|
|
It works very nice, but I had to deactivate AJAX (AJAX Refresh Rate = 0).
The AJAX-function destroyed the complete page. |
|
Back to top |
|
|
dondino Board Member
Joined: 09 Dec 2008
Posts: 144
|
Posted: Thu Jul 01, 2010 10:47 am Post subject: Re: Top 10 markup |
|
|
maybe dog cow can revise its code |
|
Back to top |
|
|
Dog Cow Board Member
Joined: 18 Nov 2008
Posts: 378
|
|
Back to top |
|
|
|