Textpattern CMS support forum
You are not logged in. Register | Login | Help
- Topics: Active | Unanswered
#1 2017-01-22 09:18:04
- Gallex
- Member
- Registered: 2006-10-08
- Posts: 1,315
plugin for display most viewed articles
as i understand this can’t be done without plugin? if so, please suggest any which is working correctly in txp 4.6.
features: display most viewed articles from certain section, category, current month, year.
Offline
#2 2017-01-22 13:07:19
- Gallex
- Member
- Registered: 2006-10-08
- Posts: 1,315
Re: plugin for display most viewed articles
choosed smd_lately
…and needed to add this to the beginning of a plugin:
Txp::get('\Textpattern\Tag\Registry')
->register('smd_lately');
Offline
Re: plugin for display most viewed articles
uli wrote #268314:
There’s this handful of plugins that all write to the database, one way or another (alphabetical, not by popularity):
- bit_article_hitlist
- dzd_counter_view
- rsx_request_count
- rvm_counter
There is also ort_article_psort but I am afraid many of these are pretty dated.
Offline
Re: plugin for display most viewed articles
Gallex wrote #303648:
as i understand this can’t be done without plugin? if so, please suggest any which is working correctly in txp 4.6.
features: display most viewed articles from certain section, category, current month, year.
If you don’t need to count unique visitors, that’s easy to do. Just chose a custom field (say, custom_10
) that will store article hits. Then insert this into your individual article form:
<txp:php>safe_update('textpattern', 'custom_10=custom_10+1', 'ID='.parse('<txp:article_id />'));</txp:php>
and call
<txp:article_custom sort="custom_10+0 desc" />
to sort articles by the number of views.
Offline
Re: plugin for display most viewed articles
etc wrote #303664:
If you don’t need to count unique visitors, that’s easy to do. Just chose a custom field (say,
custom_10
) that will store article hits. Then insert this into your individual article form:
<txp:php>safe_update('textpattern', 'custom_10=custom_10+1', 'ID='.parse('<txp:article_id />'));</txp:php>...
and call
<txp:article_custom sort="custom_10+0 desc" />...
to sort articles by the number of views.
Nice simple tip …easily customizable to display last viewed articles (what smd_lately also do):
<txp:php>safe_update('textpattern', 'custom_10='.time(), 'ID='.parse('<txp:article_id />'));</txp:php>
Offline
Re: plugin for display most viewed articles
both of these tips would be excellent for txptips. would you guys please submit them there?
Yiannis
——————————
NeMe | hblack.art | EMAP | A Sea change | Toolkit of Care
I do my best editing after I click on the submit button.
Offline
Re: plugin for display most viewed articles
colak wrote #303667:
both of these tips would be excellent for txptips. would you guys please submit them there?
I’m quite busy for now but I’ll try to write it in the next weeks if etc can’t do it before.
Offline
Re: plugin for display most viewed articles
NicolasGraph wrote #303670:
I’m quite busy for now but I’ll try to write it in the next weeks if etc can’t do it before.
I have no time atm, sorry, please do. But I would enhance it a little more, to avoid
- bots hits (User-Agent?)
- fast reloads from the same IP (store the last IP in another cf?)
Or set a cookie?
Offline
#9 2017-02-08 09:12:26
- raminrahimi
- Member
- From: India
- Registered: 2013-03-19
- Posts: 278
Re: plugin for display most viewed articles
It’s very nesessary thing for a CMS.
I’m sure Oleg can prepare something best ;-) as he mentioned:
Offline