Jump to content
Sign in to follow this  

Popular Downloads / KB Articles on Index.php (portal home)

Recommended Posts

Hello everyone,


Ive been modifying my template for whmcs but have come across a problem.


I am re-working the homepage.tpl file, so far i have customised it just how i want it but have come across a problem getting the most popular downloads and kb articles to feed onto that page. I have the Latest News/Announcements feed working fine.


With the Announcements all i had to do was simply copy and paste the code from the announcements.tpl file into the homepage.tpl file and it worked fine but with the most popular downloads and most popular kb articles nothing is displayed. I also tried the Network issues code and that didnt work at all. It simply displayed that there is no issues (although i had created a couple to test it).


The code that displays the most popular articles from the file knowledgebase.tpl is:

<div class="kb_header">
<h4>{$LANG.knowledgebasepopular} {$LANG.knowledgebasearticles}</h4>
<div class="kb_art">
<table width="100%">
   {foreach key=num item=kbarticle from=$kbmostviews}
       <td><img src="images/article.gif" class="absmiddle" border="0" alt="Article" /> <strong><a href="{if $seofriendlyurls}knowledgebase/{$kbarticle.id}/{$kbarticle.urlfriendlytitle}.html{else}knowledgebase.php?action=displayarticle&id={$kbarticle.id}{/if}">{$kbarticle.title}</a></strong><br />
       {$kbarticle.article|truncate:150:"..."}<br />
       <span style="color:#A8A8A8;font-size:11px;">{$LANG.knowledgebaseviews}: {$kbarticle.views}</span></td>


The code for the most popular downloads from the file downloads.tpl is:

<table width="100%" border="0" cellpadding="0" cellspacing="10">


<td width="50%" align="left" valign="top"><h3>{$LANG.knowledgebasepopular} {$LANG.downloadstitle}</h3>

<table width="100%" border="0" cellpadding="10" cellspacing="0">

{foreach key=num item=download from=$mostdownloads}


<td><p>{$download.type} <a href="{$download.link}"><strong>{$download.title}</strong></a><br />

{if $download.clientsonly}<em>Login Required</em><br />

{/if}{$download.description}<br />

<span style="color:#A8A8A8;font-size:11px;">{$LANG.downloadsfilesize}: {$download.filesize}</span><br />

<br />






Does anyone have any idea what part of the code needs to be adjusted so that the feeds are correct.





Share this post

Link to post
Share on other sites

Hi Rob,


Some of the variables in WHMCS are only available on certain pages (I ran into this when I was trying to make a cart mod (like sparkys one)). I did not work out how to get the variables into the other pages, but I managed to work round it by just writing my own php to interact with the database.


I have just written a bit of code to do the knowledgebase articles on any page. The code isn't very pretty at the moment, but I'll have a play around and possibly post it on the community add-ons a bit later if there is any interest.





Share this post

Link to post
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.

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.

Sign in to follow this  

  • 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