News: Welcome to the TinyPortal Support site.

Login  |  Register
HTML5 Icon HTML5 Icon
TP on Social Media
Welcome, Guest. Please login or register.
Did you miss your activation email?

October 19, 2019, 09:51:20 AM

Login with username, password and session length

Recent

Members
  • Total Members: 3756
  • Latest: Ocean
Stats
  • Total Posts: 189092
  • Total Topics: 20765
  • Online Today: 61
  • Online Ever: 629
  • (November 08, 2018, 01:36:54 PM)
Users Online
Users: 2
Guests: 38
Total: 40

Author Topic: Error on number views ?  (Read 5678 times)

0 Members and 1 Guest are viewing this topic.

elpvn

  • Guest
Error on number views ?
« on: May 09, 2007, 07:43:40 PM »
Though I'm sure check on "Show number views" on article section but in my article it's not show correct, it still '0 views' even not ...

I'm used TP 0.98 revision 2 ,smf 1.1.2  :)

see at my site: http://www.cgezine.com
« Last Edit: August 03, 2011, 03:50:28 PM by ZarPrime »

Offline mrph

  • Jr. Member
  • **
  • Posts: 31
Re: Error on number views ?
« Reply #1 on: August 02, 2011, 02:51:57 PM »
This problem is present in curent version of Tp as well ...

Offline IchBin™

  • Developer
  • *
  • Posts: 16228
    • My Website
Re: Error on number views ?
« Reply #2 on: August 02, 2011, 02:55:13 PM »
Sorry, you're going to have to elaborate a little. I have no idea what "show number views" is.

Offline mrph

  • Jr. Member
  • **
  • Posts: 31
Re: Error on number views ?
« Reply #3 on: August 02, 2011, 03:07:35 PM »
Ok, see number of views on article, its marked red

http://www.farmaceuti.com/forum/page.516/




Offline IchBin™

  • Developer
  • *
  • Posts: 16228
    • My Website
Re: Error on number views ?
« Reply #4 on: August 02, 2011, 05:38:22 PM »
Open TPortal.php and find this section:
Code: [Select]
// update views
$request =  $smcFunc['db_query']('', '
UPDATE {db_prefix}tp_articles
SET views = views + 1
WHERE ' , is_numeric($page) ? '{int:page}' : '{string:page}' , ' LIMIT 1',
array('page' => $pag)
);

Replace that code with this:
Code: [Select]
// update views
$request =  $smcFunc['db_query']('', '
UPDATE {db_prefix}tp_articles
SET views = views + 1
WHERE ' . (is_numeric($page) ? '{int:page}' : '{string:page}') . ' LIMIT 1',
array('page' => $page)
);

In the future if you wouldn't mind starting your own topic and linking to anything you find related that would be appreciated. Instead of bringing a 2007 topic back from the dead. :)

Offline mrph

  • Jr. Member
  • **
  • Posts: 31
Re: Error on number views ?
« Reply #5 on: August 03, 2011, 04:55:43 AM »
It still doesn't count new views and do not show it.

Offline IchBin™

  • Developer
  • *
  • Posts: 16228
    • My Website
Re: Error on number views ?
« Reply #6 on: August 03, 2011, 07:25:06 AM »
Oops, change this line:
WHERE ' . (is_numeric($page) ? '{int:page}' : '{string:page}') . ' LIMIT 1',

To this:
WHERE ' . (is_numeric($page) ? 'id = {int:page}' : 'shortname = {string:page}') . ' LIMIT 1',

Offline mrph

  • Jr. Member
  • **
  • Posts: 31
Re: Error on number views ?
« Reply #7 on: August 03, 2011, 02:40:22 PM »
Now it's ok.
Thanks.
:)