Forum Index
RegisterSearchFAQMemberlistUsergroupsLog in
Displaying most viewed posts
Goto page 1, 2  Next
 
Reply to topic    Forum Index » Suggestions View previous topic
View next topic
Displaying most viewed posts
Author Message
PJR
Guest





Post Displaying most viewed posts Reply with quote
There would be nice function displaying XX viewed posts and it could be limited by time - for example 10 most viewed posts in last 30 days etc.
Mon Oct 17, 2005 3:13 pm
Guest








Please login to hide the ads.

lexa
Creator of CuteNews.RU


Joined: 02 Oct 2005
Posts: 90
Location: St.-Petersburg, Russia

Post Reply with quote
Like that?



Code:
$mktime = (time() - 3600 * 24 * 30);

$number = 10;

$year = date('Y', $mktime);

$month = date('m', $mktime);

$sort = array('views', 'DESC');

include $cutepath.'/show_news.php';




$mktime = (time() - 1 * 2 * 3);



1 - houre;

2 - one day

3 - number days
Mon Oct 17, 2005 4:09 pm View user's profile Send private message Visit poster's website ICQ Number
PJR



Joined: 17 Oct 2005
Posts: 161
Location: Czech republic

Post Reply with quote
Yeah, exactly! Very Happy Thank you!!
Mon Oct 17, 2005 4:45 pm View user's profile Send private message
odin
Moderator


Joined: 29 Sep 2005
Posts: 138
Location: Poland

Post Reply with quote
Yes, lexa is clever beast Laughing
Tue Oct 18, 2005 5:00 pm View user's profile Send private message MSN Messenger
x-byte



Joined: 14 Nov 2005
Posts: 170

Post Reply with quote
This doesn't seem to work for me.. It looks like it only displays the most viewed artikle that was posted more than 30 days ago... If I change the time to 3600 * 24 * 0, it displayes the most viewed, but not every artikle, just the recent ones... very strange.



Am I doing it wrong or what?
Wed Dec 21, 2005 5:25 am View user's profile Send private message Visit poster's website
odin
Moderator


Joined: 29 Sep 2005
Posts: 138
Location: Poland

Post Reply with quote
3600 * 24 * 1 ?
Wed Dec 21, 2005 10:57 am View user's profile Send private message MSN Messenger
x-byte



Joined: 14 Nov 2005
Posts: 170

Post Reply with quote
odin wrote:
3600 * 24 * 1 ?


Tried.. doesn't display all articles, just some of them. I I've cleared the cache each time I've change something. Nothing helps.
Wed Dec 21, 2005 11:32 am View user's profile Send private message Visit poster's website
DiGiTAL



Joined: 16 Oct 2005
Posts: 64
Location: Ukraine

Post Reply with quote
look, [x-byte], explain what do you want to see at all
Wed Dec 21, 2005 12:13 pm View user's profile Send private message Send e-mail Visit poster's website Yahoo Messenger ICQ Number
x-byte



Joined: 14 Nov 2005
Posts: 170

Post Reply with quote
10 most view articles or something...
Wed Dec 21, 2005 1:31 pm View user's profile Send private message Visit poster's website
FI-DD
Admin


Joined: 22 Sep 2005
Posts: 2736
Location: Germany

Post Reply with quote
What about this:

Code:
$number = 10;

$sort = array('views', 'DESC');

include $cutepath.'/show_news.php';

Wed Dec 21, 2005 2:11 pm View user's profile Send private message
x-byte



Joined: 14 Nov 2005
Posts: 170

Post Reply with quote
FI-DD wrote:
What about this:

Code:
$number = 10;

$sort = array('views', 'DESC');

include $cutepath.'/show_news.php';


Thanks Smile
Wed Dec 21, 2005 2:29 pm View user's profile Send private message Visit poster's website
odin
Moderator


Joined: 29 Sep 2005
Posts: 138
Location: Poland

Post Reply with quote
Muhahahahahahahahahah Laughing Laughing Laughing Laughing

READ THE README !!!!!! Very Happy
Wed Dec 21, 2005 4:44 pm View user's profile Send private message MSN Messenger
Dr.Twister



Joined: 23 Apr 2007
Posts: 55

Post Reply with quote
Read through a few posts on this topic and I'm also still a bit confused. So I'll ask the question this way.

Can you sort VIEWS by a time period? I didn't think the database was timestamping all views. For instance I want to show the MOST VIEWED articles for the last week or last month or last period of time. The $sort = array('views', 'DESC'); sorts ALL articles no matter when they were published.

The problem you run into is say you have a scenario like this.

Article 1 = 1,000 total views
Article 2 = 900 total views
Article 3 = 800 total views
Article 4 = 700 total views

$sort = array('views', 'DESC'); should return articles 1,2,3,4

BUT what if you had this scenario

Article 1 was published in January and got 1,000 total views in Jan & Feb
Article 2 was published in March and got 900 total views in Mar & Apr
Article 3 was published in August and got 800 total views in Aug & Sept
Article 4 was published in October and got 700 total views in October alone

The sort array would still list them in the order of 1,2,3,4 however Article 1 is listed as most viewed even though it technically hasn't received a view since February and Article 4 is listed in last place even though it's received 700 views in just the last few weeks.

I'm wondering if there is a way to distinguish between historical views and recent reviews. So the first example would be historical and the second example would be current or most popular today.

Would love to have this, but again, I don't believe the data is available.
Tue Oct 16, 2007 1:05 pm View user's profile Send private message Visit poster's website
FI-DD
Admin


Joined: 22 Sep 2005
Posts: 2736
Location: Germany

Post Reply with quote
It's possible to show the most viewed articles of the last X days:
http://english.cutenews.ru/forum/most-populair-news-%28views-x-rating%29-t1279.html#7384
(Needs some adjustments to get rid of the rating stuff.)

Or something like that should work too:
Code:
$year = date('Y', time());
$month = date('m', time());
$day = date('d', time()) - 14;
$sort = array('views', 'DESC');

include("news/show_news.php");

It should show the most viewed posts of the last 14 days.
Tue Oct 16, 2007 4:01 pm View user's profile Send private message
Dr.Twister



Joined: 23 Apr 2007
Posts: 55

Post Reply with quote
Yea neither of those work. Well let me rephrase, they work for what they are doing but not for what I was attempting to outline. Let me try to explain a different way.

In both of the solutions we are showing the most popular items for the last 14 days. The problem is, it's showing you the most popular items out of ONLY the news stories which were POSTED in the last 14 days. Meaning if something was posted on a date older the 14 days, it would not be considered in the mix. Something posted 15 days ago would be ignored.

That's different than showing the most popular articles our of ALL AVAILABLE articles posted on ANY date, but had the most activity or clicks or views for the last 14 days. So in theory in this example, something posted 15 days ago and had 100 views during the last 14 days could appear on the list of most popular items.

For example I'm doing a media site and I want to track the most popular videos. Well if I keep accumulating views, then the most popular will always be on the top... it has 6,000 views. The problem is, that video has been on the site for several months, we have tons of newer videos, and it's not the most popular video on the site today. The video which is getting hit the most today only has a total of 1,000 views, but it's still the most popular video on the site currently.

I believe in order to track this though, there would need to be some type of table which tracked the time stamps of when every article posted was actually viewed by a guest. You could then perform a query and return all post_ids between a time stamp range and sorted by most hits during that time period.

post_id, view_timestamp
1, Mon
1, Mon
1, Mon
2, Mon
3, Mon
1, Tue
2, Tue

So I'd end up with post_id 1 had 4 views and post_id 3 had 1 view where in theory post_id 3 is a newer article than post_id 1

To me this doesn't seem like a good solution because if you have a lot of stories and a lot of traffic this table would fill up very quickly. Now if there was a way to purge the table on a continous setting, say every 7 days or what not... then maybe it would work. Or maybe ever 24 hours... but still, not sure it's a great solution.

Either way, I think finding a solution would be nice to have for everyone.
Wed Oct 17, 2007 1:02 am View user's profile Send private message Visit poster's website
Display posts from previous:    
Reply to topic    Forum Index » Suggestions All times are GMT + 1 Hour
Goto page 1, 2  Next
Page 1 of 2

 
Jump to: 
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum



Powered by phpBB © 2001, 2005 phpBB Group
Design by Freestyle XL / Music Lyrics.