TP-Docs
HTML5 Icon HTML5 Icon HTML5 Icon
TP on Social Media

Recent

Welcome to TinyPortal. Please login or sign up.

April 18, 2024, 03:13:57 AM

Login with username, password and session length
Members
  • Total Members: 3,885
  • Latest: Growner
Stats
  • Total Posts: 195,164
  • Total Topics: 21,219
  • Online today: 190
  • Online ever: 3,540 (September 03, 2022, 01:38:54 AM)
Users Online
  • Users: 0
  • Guests: 155
  • Total: 155

Error on number views ?

Started by elpvn, May 10, 2007, 02:43:40 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

elpvn

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

mrph

This problem is present in curent version of Tp as well ...

IchBin

Sorry, you're going to have to elaborate a little. I have no idea what "show number views" is.

mrph


IchBin

Open TPortal.php and find this section:
// 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:
// 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. :)

mrph

It still doesn't count new views and do not show it.

IchBin

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',

mrph