TinyPortal

Development => Feedback => Bugs/Errors => Topic started by: elpvn on May 10, 2007, 02:43:40 AM

Title: Error on number views ?
Post by: elpvn on May 10, 2007, 02:43:40 AM
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
Title: Re: Error on number views ?
Post by: mrph on August 02, 2011, 09:51:57 PM
This problem is present in curent version of Tp as well ...
Title: Re: Error on number views ?
Post by: IchBin on August 02, 2011, 09:55:13 PM
Sorry, you're going to have to elaborate a little. I have no idea what "show number views" is.
Title: Re: Error on number views ?
Post by: mrph on August 02, 2011, 10:07:35 PM
Ok, see number of views on article, its marked red

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



Title: Re: Error on number views ?
Post by: IchBin on August 03, 2011, 12:38:22 AM
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. :)
Title: Re: Error on number views ?
Post by: mrph on August 03, 2011, 11:55:43 AM
It still doesn't count new views and do not show it.
Title: Re: Error on number views ?
Post by: IchBin on August 03, 2011, 02:25:06 PM
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',
Title: Re: Error on number views ?
Post by: mrph on August 03, 2011, 09:40:22 PM
Now it's ok.
Thanks.
:)