Jump to content

Announcements on WHMCS main client area page


Recommended Posts

  • 4 weeks later...

I tried this php below:

{php}include('http://mydomain.com/whmcs/news.php');{/php}

(I also tried using path...but the page choked and stop.)

 

It seems if I remove both include() in news.php then the page would go albeit the news.php would not producing anything if I do that.

 

To sums up, I can't use include('configuration.php') & include('include/functions.php') in the news.php

 

:(

Link to comment
Share on other sites

  • WHMCS Developer

Try this

{php}

// Get Articles with highest count

$i=0;

$client_query = "SELECT * FROM tblknowledgebase ORDER BY views DESC LIMIT 5";

$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}

<table width="90%" align="center" cellpadding=0 cellspacing=0>

<tr>

<td width="50%" valign=top>

 

{$LANG.knowledgebasepopular} {$LANG.knowledgebasearticles}</p>

<table width="100%">

{foreach key=num item=kbarticle from=$kbmostviews}

<tr>

<td> article.gif {$kbarticle.title}

 

{$kbarticle.article|truncate:100:"..."}

<font style="color:#A8A8A8;font-size:10px;">{$LANG.knowledgebaseviews}:

{$kbarticle.views}</FONT> </td>

</tr>

{/foreach} </table></td>

</tr>

</table>

 

Edit homepage.tpl

Link to comment
Share on other sites

Here is the code if you want to include Announcements on a Template page:

 

{php}
$query = "SELECT * FROM tblannouncements WHERE published='on' ORDER BY date DESC";
$result=mysql_query($query);
while($data = mysql_fetch_array($result)) {
$id = $data["id"];
$date = $data["date"];
$title = $data["title"];
$announcement = $data["announcement"];
$date = fromMySQLDate($date);
echo("

<font color=#cccccc>$date</font> - [b]$title[/b]
$announcement</p>");}
{/php}

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