Removing view count

In this board you can talk about general questions about phpMyFAQ

Moderator: Thorsten

Post Reply
jimmyswan
Posts: 2
Joined: Tue May 08, 2012 10:07 pm

Removing view count

Post by jimmyswan »

Hello,

How can I remove the view count (number of views) for all articles? For me it appears on the Index.php?action=show&cat=3 pages.

I searched the templates but could not find where to remove this.

Thanks, =J
Thorsten
Posts: 15749
Joined: Tue Sep 25, 2001 11:14 am
Location: #phpmyfaq
Contact:

Re: Removing view count

Post by Thorsten »

Hi,

I can provide a hack, but you have to change the code after each phpMyFAQ update.

bye
Thorsten
phpMyFAQ Maintainer and Lead Developer
amazon.de Wishlist
jimmyswan
Posts: 2
Joined: Tue May 08, 2012 10:07 pm

Re: Removing view count

Post by jimmyswan »

That's fine, a hack will work. I'll remember to change it for each update.
Thorsten
Posts: 15749
Joined: Tue Sep 25, 2001 11:14 am
Location: #phpmyfaq
Contact:

Re: Removing view count

Post by Thorsten »

Hi,

please open inc/Faq.php at line 445 and change this code

Code: Select all

                $listItem = sprintf('<li>%s<span id="viewsPerRecord"><br /><span class="little">(%s)</span>%s</span></li>',
                    $oLink->toHtmlAnchor(),
                    $this->plr->GetMsg('plmsgViews', $visits),
                    ($row->sticky == 1) ? '<br /><br />' : '');
to this

Code: Select all

                $listItem = sprintf('<li>%s</li>',
                    $oLink->toHtmlAnchor());
bye
Thorsten
phpMyFAQ Maintainer and Lead Developer
amazon.de Wishlist
ElectronicWar
Posts: 1
Joined: Fri Jun 15, 2012 11:01 am
Location: Germany

Re: Removing view count

Post by ElectronicWar »

Would be great to have this as an option in a future version (same with complete removal of social sharing which already seems to be some sort of standalone option in the templates).
wombat
Posts: 2
Joined: Thu Jul 25, 2013 5:10 pm

Re: Removing view count

Post by wombat »

May I kindly know how to do this in v2.8.1 ?
No much luck modifying Faq.php

Thanks in advance.
Thorsten
Posts: 15749
Joined: Tue Sep 25, 2001 11:14 am
Location: #phpmyfaq
Contact:

Re: Removing view count

Post by Thorsten »

Hi,

for 2.8.1, it's line 433 in inc/PMF/Faq.php, change

Code: Select all

                $renderedItems[] = sprintf(
                    '<li%s>%s<span id="viewsPerRecord"><br /><small>(%s)</small></span></li>',
                    ($row->sticky == 1) ? ' class="sticky-faqs"' : '',
                    $oLink->toHtmlAnchor(),
                    $this->plr->GetMsg('plmsgViews', $visits)
                );
to

Code: Select all

                $renderedItems[] = sprintf(
                    '<li%s>%s</li>',
                    ($row->sticky == 1) ? ' class="sticky-faqs"' : '',
                    $oLink->toHtmlAnchor()
                );
bye
Thorsten
phpMyFAQ Maintainer and Lead Developer
amazon.de Wishlist
wombat
Posts: 2
Joined: Thu Jul 25, 2013 5:10 pm

Re: Removing view count

Post by wombat »

Many thanks! It works =)
Post Reply