View Full Version : WHMNews PHP Script (Put Announcements on your site)
Hello, i've made a php script for display the WHMCS Announcements on a site. If you want you can distribute this, but not remove the copyright.
Demo:
Demo: http://dev.forcis.es/whmcs/news.php
Site integration Demo: http://www.forcis.es
WHMCS Announcements: http://clientes.forcis.es/announcements.php
Downloads:
zip package: http://dev.forcis.es/whmcs/whmcsnews.zip
tar.gz package: http://dev.forcis.es/whmcs/whmcsnews.tar.gz
Installation Instructions:
1) Unzip and upload the files to your host.
2) Edit whmnews.inc.php:
- Enter the database settings of WHMCS
- Choose the number of news to display on the page, the font and is size.
- Please set support at 1 for help us. If you don't want to support Forcis Networks, set it to 0.
This is a greate script:)
But is it possible to add the title to it,
and i seem not to be able to intergrate it to the templates in whmcs?
gismo, I haven't tried his script because I use my own, but once you set it up, you should be able to use <?php include_once('/path/to/news.php');?> anywhere in the templates to display it.
This script is so old that it won't display the announcement title as this was only added recently. There's a very simple way of displaying news articles on your site. If I get time, I'll post it here at some point.
Here's what I'm using on my homepage:
http://www.koreru.com
function latestNews()
{
include("WHMCSFOLDER/configuration.php");
include("WHMCSFOLDER/includes/functions.php");
$link = mysql_connect($db_host,$db_username,$db_password);
mysql_select_db($db_name);
$query = "SELECT * FROM tblannouncements WHERE published='on' ORDER BY date DESC LIMIT 1";
$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("
<table cellpadding=\"3\" cellspacing=\"0\" style=\"border:none;text-align:left;width:755px;\">
<tr style=\"background-color:#A2DAFF;\">
<td>
<font color=\"#000\">$date</font> - $title
</td>
</tr>
<tr style=\"background-color:#FFFFFF;\">
<td>
$announcement</p>
</td>
</tr>
</table>");
}
}
No copyright necessary.
In fact, Matt already has this in the knowledgebase. That's where I got it from.
http://support.whmcs.com/knowledgebase.php?action=displayarticle&catid=7&id=18
The code I use only shows the latest one. The version in the knowledgebase returns all of them.
gismo, I haven't tried his script because I use my own, but once you set it up, you should be able to use <?php include_once('/path/to/news.php');?> anywhere in the templates to display it.
I got it to wotk on my homepage but not in
whmcs template that is the problem.
How about this?
{php}
include_once('whatever_file_has_the_latestNews_fun ction_that_i_provided.php');
latestNews();
{/php}
By the way, I haven't tried this.
Works like a dream:)
Thank you!
sheanichole
10-11-06, 04:22 PM
I am trying to implement this, but am running into a problem with ioncube?!
My whmcs is installed here: http://www.sayshea.com/support/
and is working fine. It was a bit hairy for me to get it installed on my server but my host finally got ioncube installed and the register globals turned on. I've been using it now for a couple weeks with no problems.
My question, if ioncube is loaded, shouldn't it work anywhere on my site?
I am trying to implement the announcements on my contact page (here is a test page so you can see what is happening):
http://www.sayshea.com/contact-announcements.htm
I am getting this message:
The file /home/sayshea/public_html/support/includes/functions.php has been encoded with the ionCube PHP Encoder and requires the free ioncube_loader_lin_4.4.so ionCube PHP Loader to be installed.
I'm not sure if it is something I need to do on my end or not. I did put in a support ticket to my host because I don't have access to the server level, so I'm asking them to load that file in ioncube for me.
sheanichole
10-11-06, 05:06 PM
Alrighty, my host came through for me and found out what the problem was. Apparently it was something with my php.ini file, and they fixed it. So now all works as should!
I just love this program! It is already making my life so much easier.
Powered by vBulletin® Version 4.2.0 Copyright © 2013 vBulletin Solutions, Inc. All rights reserved.