Jump to content

Number of views for KB articles gone?


HostinPK

Recommended Posts

Mods @ Please move this thread to "Customisation and Integration Questions"

 

- - - Updated - - -

 

and here is WHMCS support reply

 

"The number of article views is not displayed in the default template, but it is displayed in the older portal and classic templates.

It should be possible to copy the {$kbarticle.views} tag from these templates into the default template knowledgebasecat.tpl file in order to display it there too."

 

I am using six template and want to show the number of views. Can anyone help me in this regard using the guideline given above.

Link to comment
Share on other sites

you could modify six/knowledgebasecat.tpl and replace...

 

    <div class="kbarticles">
       {foreach from=$kbarticles item=kbarticle}
           <a href="{if $seofriendlyurls}{$WEB_ROOT}/knowledgebase/{$kbarticle.id}/{$kbarticle.urlfriendlytitle}.html{else}knowledgebase.php?action=displayarticle&id={$kbarticle.id}{/if}">
               <span class="glyphicon glyphicon-file"></span> {$kbarticle.title}
           </a>
           <p>{$kbarticle.article|truncate:100:"..."}</p>
       {foreachelse}
           {include file="$template/includes/alert.tpl" type="info" msg=$LANG.knowledgebasenoarticles textcenter=true}
       {/foreach}
   </div>

with...

 

    <div class="kbarticles">
       {foreach from=$kbarticles item=kbarticle}
           <a href="{if $seofriendlyurls}{$WEB_ROOT}/knowledgebase/{$kbarticle.id}/{$kbarticle.urlfriendlytitle}.html{else}knowledgebase.php?action=displayarticle&id={$kbarticle.id}{/if}">
               <span class="glyphicon glyphicon-file"></span> {$kbarticle.title}
           </a>
           <p>{$kbarticle.article|truncate:100:"..."}</p>
           <span class="badge badge-info">{$kbcat.numarticles}</span> 
           <p>{$LANG.knowledgebaseviews}: {$kbarticle.views}</p>
       {foreachelse}
           {include file="$template/includes/alert.tpl" type="info" msg=$LANG.knowledgebasenoarticles textcenter=true}
       {/foreach}
   </div>

or if you wanted to show the number of views in a badge...

 

<span class="badge badge-info">{$LANG.knowledgebaseviews}: {$kbarticle.views}</span> 

Link to comment
Share on other sites

the popular kb articles are in kbknowledgebase.tpl, so you'll need to modify a different template for that... ~line 34

 

<span class="glyphicon glyphicon-file"></span> {$kbarticle.title} ({$LANG.knowledgebaseviews}: {$kbarticle.views})

that will add a bracketed number of views for the popular articles.

 

it's also worth noting that the views number is in all three kb templates in Portal, so you might need to consider adding it to knowledgebasearticle.tpl too.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use & Guidelines and understand your posts will initially be pre-moderated