skshost Posted March 4, 2007 Share Posted March 4, 2007 Most popular Knowledgebase articles on the support homepage. I assumed that I'd find a checkbox in admin to turn it on, do I have to build this? 0 Quote Link to comment Share on other sites More sharing options...
Adam Posted March 4, 2007 Share Posted March 4, 2007 Most popular Knowledgebase articles on the support homepage. I assumed that I'd find a checkbox in admin to turn it on, do I have to build this? Hey, You have to built it your self... From, Adam 0 Quote Link to comment Share on other sites More sharing options...
skshost Posted March 4, 2007 Author Share Posted March 4, 2007 <table width=100%> {foreach key=num item=kbarticle from=$kbmostviews} <tr><td> [img=images/support/article.gif] [b][url="knowledgebase.php?action=displayarticle&catid={$kbarticle.category}&id={$kbarticle.id}"]{$kbarticle.title}[/url][/b] {$kbarticle.article|truncate:50:"..."} <font style="color:#A8A8A8;font-size:10px;">{$LANG.knowledgebaseviews}: {$kbarticle.views}</FONT> </td></tr> {/foreach} </table> Looks simple, but I get nothing outside of knowledgebase.php 0 Quote Link to comment Share on other sites More sharing options...
yabado Posted March 4, 2007 Share Posted March 4, 2007 I do not believe that page provides the necessary smarty variables for you to use that code. Add {debug} to that page and reload. A popup window will reveal to you what is available to the template. You can, however, use {php} code to add it yourself. Just do a search for all articles and base the order on the number of views. Then save all the results into an array, pass it to smarty, then use the same code above to display. I plan to do this myself. When I do I will post the code on the forums. 0 Quote Link to comment Share on other sites More sharing options...
yabado Posted March 4, 2007 Share Posted March 4, 2007 OK, try this. Here is the php code you need to add to the top of your clientareahome.tpl page. {php} // Get Articles with highest count $client_query = "SELECT * FROM tblknowledgebase ORDER BY views LIMIT 10"; $result = mysql_query($client_query); while($row = mysql_fetch_array($result)) { $kbmostviews_array['id'] .= $row['id']; $kbmostviews_array['category'] .= $row['category']; $kbmostviews_array['title'] .= $row['title']; $kbmostviews_array['article'] .= $row['article']; $kbmostviews_array['views'] .= $row['views']; } //Pass the values to smarty $this->assign('kbmostviews',$kbmostviews_array); {/php} Then you can use the exact same template code to display the articles. I have not tested it yet, but it should work.[/code] 0 Quote Link to comment Share on other sites More sharing options...
skshost Posted March 4, 2007 Author Share Posted March 4, 2007 Didn't work, just shows # of views and same value for article name. I think I see what your doing though. 0 Quote Link to comment Share on other sites More sharing options...
yabado Posted March 6, 2007 Share Posted March 6, 2007 OK, this works. {php} // Get Articles with highest count $i=0; $client_query = "SELECT * FROM tblknowledgebase ORDER BY views LIMIT 10"; $result = mysql_query($client_query); while($row = mysql_fetch_array($result)) { $kbmostviews_array[$i]['id'] = $row['id']; $kbmostviews_array[$i]['category'] = $row['category']; $kbmostviews_array[$i]['title'] = $row['title']; $kbmostviews_array[$i]['article'] = strip_tags($row['article']); $kbmostviews_array[$i]['views'] = $row['views']; $i++; } //Pass the values to smarty $this->assign('kbmostviews',$kbmostviews_array); {/php} 0 Quote Link to comment Share on other sites More sharing options...
skshost Posted March 8, 2007 Author Share Posted March 8, 2007 Thanks alot! 0 Quote Link to comment Share on other sites More sharing options...
bucketshop Posted March 16, 2007 Share Posted March 16, 2007 Isn't this already in the current version of WHMCS? What I would like to do is get the "highest rated" articles that have the most votes. I would also like to get the most recent articles. How would I go about that? 0 Quote Link to comment Share on other sites More sharing options...
bucketshop Posted March 16, 2007 Share Posted March 16, 2007 I didn't read in enough detail. I now see the OP wanted it on the support "homepage". 0 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.