SoBeIt Posted June 1, 2008 Share Posted June 1, 2008 How do I get the first couple of announcements listed on the WHMCS index page? I tried the code at available at http://wiki.whmcs.com/Linking_to_WHMCS which works fine on its own, but it doesn't seem to work from within WHMCS. If the text could be truncated it would be a bonus. 0 Quote Link to comment Share on other sites More sharing options...
dutchnet Posted June 3, 2008 Share Posted June 3, 2008 you should put {php} and {/php} arround the code in your homepage.tpl file the complete source would look like: {php} $query = "SELECT * FROM tblannouncements WHERE published='on' ORDER BY date DESC LIMIT 0,3"; $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("<p><font color=#cccccc>$date</font> - <b>$title</b><br>$announcement</p>"); } {/php} To truncate your messages have a close look at http://www.the-art-of-web.com/php/truncate/ 0 Quote Link to comment Share on other sites More sharing options...
Serverweb Posted June 3, 2008 Share Posted June 3, 2008 <?php include("PATH/configuration.php"); include("PATH/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 5"; $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("News $date<a href=http://www.LINKSITE.xx/announcements.php?id=$id target=blank>$title</a>"); } ?> i modify With link.....and i limit first 5 news 0 Quote Link to comment Share on other sites More sharing options...
SoBeIt Posted June 4, 2008 Author Share Posted June 4, 2008 Great, thank you, it works fine now I thought the truncate feature would only require an extra line in the code or something simple, looking at that URL I think I'll just have to keep my announcements short! 0 Quote Link to comment Share on other sites More sharing options...
BAJI26 Posted June 4, 2008 Share Posted June 4, 2008 Check this out! 0 Quote Link to comment Share on other sites More sharing options...
apollo1 Posted June 5, 2008 Share Posted June 5, 2008 <?php include("PATH/configuration.php"); include("PATH/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 5"; $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("News $date<a href=http://www.LINKSITE.xx/announcements.php?id=$id target=blank>$title</a>"); } ?> i modify With link.....and i limit first 5 news I am confused how that can work -- in the wiki article the 2nd line is supposed to be: include("support/dbconnect.php"); Why do you have configuration.php? 0 Quote Link to comment Share on other sites More sharing options...
jnet Posted June 5, 2008 Share Posted June 5, 2008 what about outside of whmcs:?:: 0 Quote Link to comment Share on other sites More sharing options...
BAJI26 Posted June 5, 2008 Share Posted June 5, 2008 what about outside of whmcs:?:: You can have it on pages outside whmcs, you have to change the path. 0 Quote Link to comment Share on other sites More sharing options...
apollo1 Posted June 5, 2008 Share Posted June 5, 2008 When I add the script from the wiki to the front page of my website, this is what I get in the section where the announcements should appear: Site error: the file /home/myaccount/public_html/whmcs/dbconnect.php requires the ionCube PHP Loader ioncube_loader_lin_4.4.so to be installed by the site administrator. I have a copy of php.ini in my public_html folder as well as a copy of ioncube_loader_lin_4.4.so. The very same code works if I put my php page inside my whmcs folder. Of course, I am adjusting all paths relatively as required. I just don't get it. 0 Quote Link to comment Share on other sites More sharing options...
apollo1 Posted June 7, 2008 Share Posted June 7, 2008 bump.. anyone? 0 Quote Link to comment Share on other sites More sharing options...
Zorro67 Posted June 7, 2008 Share Posted June 7, 2008 Hi Apollo1, had to tweak to get the code to work inside whmcs, below is what I use, error free. <p><b><a href="announcements.php">Recent Announcements</a></b><br /></p> {php} $query = "SELECT * FROM tblannouncements WHERE published='on' ORDER BY date DESC LIMIT 0,6"; $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("<p><img src=\"images/clientarea/bullet2.gif\" align=\"middle\" alt=\"article\"/> <font color=\"#800000\"> $date</font><br/><b>$title</b></p>"); } {/php} the \ inside the echo escape the quotes that you need to be error free, which is a missing component to silverweb's code. I've included code for a bullet icon. rename it to whatever you want, and change the location to wherever suits your setup. As the announcement page are not individually viewed, i thought it better just to link the heading & take them to the whole page. Clients can scroll down to find the one they want. Cheers 0 Quote Link to comment Share on other sites More sharing options...
apollo1 Posted June 7, 2008 Share Posted June 7, 2008 Thanks very much Zorro67, I will give that a try! 0 Quote Link to comment Share on other sites More sharing options...
Serverweb Posted July 6, 2008 Share Posted July 6, 2008 I've several error after upgrade 3.6.2:( my announcements include in home don't work:( 0 Quote Link to comment Share on other sites More sharing options...
Beatle Posted July 8, 2008 Share Posted July 8, 2008 you should put {php} and {/php} arround the code in your homepage.tpl file the complete source would look like: To truncate your messages have a close look at http://www.the-art-of-web.com/php/truncate/ My hompage.tpl file looks nothing like that, so I am a bit leary of trying to add that code to it. Here is what I have in my hompage.tpl file: <table width="100%" border="0" cellspacing="0" cellpadding="0"><tr><td>{$LANG.headertext}</td><td align="right">{if $showpresales}{$LANG.supportpresalesquestions}, <a href="contact.php">{$LANG.supportclickheretocontact}</a>.{/if}</td></tr></table> <br /> <table width="100%" border="0" align="center" cellpadding="12" cellspacing="0" style="border: 1px solid #e0e0e0;"> <tr><td width="10%"><div align="center"><a href="clientarea.php"><img src="images/clientarea_big.gif" alt="{$LANG.clientareatitle}" /></a></div></td><td width="40%" style="padding-left:5px;"><a href="clientarea.php"><strong>{$LANG.clientareatitle}</strong></a><br />{$LANG.clientareadescription}</td><td width="10%" bgcolor="#EFF2F9"><div align="center"><a href="submitticket.php"><img src="images/submitticket_big.gif" alt="{$LANG.supportticketssubmitticket}" /></a></div></td><td width="40%" bgcolor="#EFF2F9" style="padding-left:5px;"><a href="submitticket.php"><strong>{$LANG.supportticketssubmitticket}</strong></a><br />{$LANG.submitticketdescription}</td></tr> <tr><td width="10%" bgcolor="#EFF2F9"><div align="center"><a href="knowledgebase.php"><img src="images/knowledgebase_big.gif" alt="{$LANG.knowledgebasetitle}"/></a><a href="clientarea.php"></a></div></td><td width="40%" bgcolor="#EFF2F9" style="padding-left:5px;"><a href="knowledgebase.php"><strong>{$LANG.knowledgebasetitle}</strong></a><br />{$LANG.knowledgebasedescription}</td><td width="10%"><div align="center"><a href="supporttickets.php"><img src="images/supporttickets_big.gif" alt="{$LANG.supportticketspagetitle}" /></a></div></td><td width="40%" style="padding-left:5px;"><a href="supporttickets.php"><strong>{$LANG.supportticketspagetitle}</strong></a><br />{$LANG.viewticketsdescription}</td></tr> <tr><td width="10%"><div align="center"><a href="announcements.php"><img src="images/announcements_big.gif" alt="{$LANG.announcementstitle}" /></a></div></td><td width="40%" style="padding-left:5px;"><a href="announcements.php"><strong>{$LANG.announcementstitle}</strong></a><br />{$LANG.announcementsdescription}</td><td width="10%" bgcolor="#EFF2F9"><div align="center"><a href="cart.php"><img src="images/order_big.gif" alt="{$LANG.ordertitle}" /></a></div></td><td width="40%" bgcolor="#EFF2F9" style="padding-left:5px;"><a href="cart.php"><strong>{$LANG.ordertitle}</strong></a><br />{$LANG.orderhomedescription}</td></tr> <tr><td width="10%" bgcolor="#EFF2F9"><div align="center"><a href="affiliates.php"><img src="images/affiliate_big.gif" alt="{$LANG.affiliatestitle}" /></a></div></td><td width="40%" bgcolor="#EFF2F9" style="padding-left:5px;"><a href="affiliates.php"><strong>{$LANG.affiliatestitle}</strong></a><br />{$LANG.affiliatesdescription}</td><td width="10%"><div align="center"><a href="downloads.php"><img src="images/downloads_big.gif" alt="{$LANG.downloadstitle}" /></a></div></td><td width="40%" style="padding-left:5px;"><a href="downloads.php"><strong>{$LANG.downloadstitle}</strong></a><br />{$LANG.downloadsdescription}</td></tr> <tr><td width="10%"><div align="center"><a href="domainchecker.php"><img src="images/domains_big.gif" alt="{$LANG.domaintitle}" /></a></div></td><td width="40%" style="padding-left:5px;"><a href="domainchecker.php"><strong>{$LANG.domaintitle}</strong></a><br />{$LANG.availabilitydescription}</td><td width="10%" bgcolor="#EFF2F9"><div align="center"><a href="serverstatus.php"><img src="images/status_big.gif" alt="{$LANG.serverstatustitle}" /></a></div></td><td width="40%" bgcolor="#EFF2F9" style="padding-left:5px;"><a href="serverstatus.php"><strong>{$LANG.serverstatustitle}</strong></a><br />{$LANG.serverstatusdescription}</td></tr> </table> <br /> Where should I enter your code so that I can get the announcements to show up on the main page when a user logs in? Thanks in advance! 0 Quote Link to comment Share on other sites More sharing options...
Terry Posted July 10, 2008 Share Posted July 10, 2008 I can't seem to get this to work...anybody? 0 Quote Link to comment Share on other sites More sharing options...
Timoots Posted July 11, 2008 Share Posted July 11, 2008 I can't seem to get this to work...anybody? Im having the same problem after I upgraded to v3.6.2 0 Quote Link to comment Share on other sites More sharing options...
jmfemedia.net Posted July 18, 2008 Share Posted July 18, 2008 I am also looking for help on this. I had it working fine until I renewed my licence to 3.6.2 http://jmfemedia.net < main page http://billing.jmfemedia.net < whmcs install 0 Quote Link to comment Share on other sites More sharing options...
handsonwebhosting Posted July 18, 2008 Share Posted July 18, 2008 For us, since our billing is on a separate server than our main page I did the following. Made an "announcements-remote.php" file in our BILLING server, and then used a PHP ECHO command to display on the page I wanted to display. So here's what I have on my site pages: <?php echo file_get_contents("[url]http://billing.handsonwebhosting.com/announcements-remote.php[/url]"); ?> And then in the "announcements-remote.php" file I have the following: *** weird, it wouldn't let me paste the full code. I'll post in a following posting. 0 Quote Link to comment Share on other sites More sharing options...
handsonwebhosting Posted July 18, 2008 Share Posted July 18, 2008 <? $x=1; // truncate the text to only 65 chars, add ... to the end function truncate($text) { $text = substr($text,0,200); $text = substr($text,0,strrpos($text,' ')); $text = $text." ... "; return $text; } // format the date to mm/dd/yyyy function formatdate($date) { $year = substr ($date, 0, 4); $month = substr ($date, 5, 2); $day = substr ($date, 8, 2); return $month.'/'.$day.'/'.$year; } // limit the number of announcements to return $limit = 3; require '/home/billing/public_html/configuration.php'; $link = mysql_connect($db_host,$db_username,$db_password); mysql_select_db($db_name); $result = mysql_query("SELECT * FROM tblannouncements WHERE published='on' ORDER BY id DESC LIMIT ".$limit); while($data = mysql_fetch_array ($result)) { $id = $data['id']; $title = $data['title']; $date = $data['date']; $announcement = truncate($data['announcement']); $date = formatdate($date); echo'<b>'.$date.' - '.$title.'</b><br>'.$announcement.' <a href="[url="http://billing.handsonwebhosting.com/announcements.php?id='.$id.'"><img"]http://billing.handsonwebhosting.com/announcements.php?id='.$id.'"><img[/url] src="[url]http://billing.handsonwebhosting.com/images/details.png[/url]" border="0" alt="more info" /></a>'; echo'<hr />'; $x=false; } if(!$x) echo '<p>Older News & announcements: < a href="http://billing.handsonwebhosting.com/announcements.php> view more </a></p>';if($x) echo '<p>There are no new announcements.</p>'; ?> 0 Quote Link to comment Share on other sites More sharing options...
handsonwebhosting Posted July 18, 2008 Share Posted July 18, 2008 wouldn't let me delete this posting. Anyway, the above code is what we used on our site - maybe it'll be of some help to you in your issue. 0 Quote Link to comment Share on other sites More sharing options...
apollo1 Posted July 19, 2008 Share Posted July 19, 2008 Thanks kindly Conor, very helpful! 0 Quote Link to comment Share on other sites More sharing options...
apollo1 Posted July 21, 2008 Share Posted July 21, 2008 wouldn't let me delete this posting. Anyway, the above code is what we used on our site - maybe it'll be of some help to you in your issue. Conor - there was one small bug in your code. The "no new announcements" isn't working right. I had to delete the line $x=false; and add the following line above the while statement. if ($result < $limit) {$x=0;} 0 Quote Link to comment Share on other sites More sharing options...
sally24 Posted July 24, 2008 Share Posted July 24, 2008 uff ... i try all the codes in this thread but in all the cases the browser return me a black page.. why? 0 Quote Link to comment Share on other sites More sharing options...
sally24 Posted July 24, 2008 Share Posted July 24, 2008 i use the kayako for the announcements and support tickets.. as i can visualize the announcements on my index? 0 Quote Link to comment Share on other sites More sharing options...
Timoots Posted July 28, 2008 Share Posted July 28, 2008 <?php include("clients/dbconnect.php"); include("clients/includes/functions.php"); $query = "SELECT * FROM tblannouncements WHERE published='on' ORDER BY date DESC LIMIT 0,5"; $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='#FF0000'>$date</font> - <b>$title</b> <br /> $announcement"); } ?> this is what i use on my website with WHMCS 3.6.2 I also made it w3c valid. checkout my site to see it working. http://www.scribblehost.com 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.