whiteatom Posted June 1, 2009 Share Posted June 1, 2009 Hi, I have installed my whmcs in a sub directory like directory.whmcs.com Now i m using the following code to display 3 announcements on my html website template .. "<?php include("support/dbconnect.php"); include("support/includes/functions.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>"); } ?>" According to whmcs I should only change the support with my directory Path I need to know what It will be ? will it be like /home/user/public_html/directory/ or will it be /public_html/directory/ or http://www.directory.whmcs.com ? I have tried them all and nothing is working I am lil confused here .. 0 Quote Link to comment Share on other sites More sharing options...
BAJI26 Posted June 1, 2009 Share Posted June 1, 2009 Change include("[color=red][b]support[/b][/color]/dbconnect.php"); include("[color=red][b]support[/b][/color]/includes/functions.php"); to the location of your directory, try the dir of your whmcs. include("[color=red][b]Where Your WHMCS Is Located[/b][/color]/dbconnect.php"); include("[color=red][b]Where Your WHMCS Is Located[/b][/color]/includes/functions.php"); 0 Quote Link to comment Share on other sites More sharing options...
whiteatom Posted June 1, 2009 Author Share Posted June 1, 2009 I have tried it but its not working somehow its not getting connected to the database file .. I am currently giving the absloute path to where my whmcs is located like "/home/user/public_html/whmcs/dbconnect.php" but its not working or should I give there html path ? like http://www.... help needed in this regard ? 0 Quote Link to comment Share on other sites More sharing options...
tjmartin Posted July 20, 2010 Share Posted July 20, 2010 have we figured out a way to show the announce.php on the front page of an html site? I have also tried everything and cant get it to work. is there a setting somewhere in the whmcs that we have to change to allow it? 0 Quote Link to comment Share on other sites More sharing options...
mylove4life Posted July 20, 2010 Share Posted July 20, 2010 <?php include("support/dbconnect.php"); include("support/includes/functions.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>"); } ?> 0 Quote Link to comment Share on other sites More sharing options...
tjmartin Posted July 25, 2010 Share Posted July 25, 2010 i will give this a try now 0 Quote Link to comment Share on other sites More sharing options...
tjmartin Posted July 25, 2010 Share Posted July 25, 2010 (edited) This does not seem to work. My site is http://recongaming.net and I have tried every configuration I can think of. Attached is the end result in everything I try. Suggestions? Also, Is this code for the latest version of whmcs? Im sure it is due to you being a senior member and all, butt I gotta ask. Edited July 25, 2010 by tjmartin 0 Quote Link to comment Share on other sites More sharing options...
gr8green Posted July 25, 2010 Share Posted July 25, 2010 I use lastrss to display a small ticker on my site site wide I was looking at doing banners but this was easier here is a link to my site http://gr8greenhosting.com the ticker is just under the chat banner on the right, If you need something like that I'd be glad to help it takes a wee bit of coding and css changing here is the site I got the script from http://www.dynamicdrive.com/dynamicindex17/rsstickerajax/index.htm 0 Quote Link to comment Share on other sites More sharing options...
ssdindia Posted September 30, 2010 Share Posted September 30, 2010 I am having also same query. I think you have got solution. Please give me that code which worked. 0 Quote Link to comment Share on other sites More sharing options...
tjmartin Posted September 30, 2010 Share Posted September 30, 2010 This mistake I had made when I built my site is that I didnt use .php tags. I had html and the code wouldnt work. a n00b like me was unaware of this and couldnt even find it online. Once you save it as a php file and insert the code, it should work fine as long as your paths are correct. Im guessing you are the one that visited my site today to see it working. Here is the code that I used and still works with the current version of whmcs. <? $x=1; // truncate the text to only 65 chars, add ... to the end function truncate($text) { $text = substr($text,0,40); $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/YOURHOSTNAME/public_html/billing/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="billing/announcements.php?id='.$id.'"><img src="../images/more.gif" border="0" alt="More »" /></a>'; echo'<hr />'; $x=false; } if(!$x) echo '<p>Older News: <a href="/billing/announcements.php">More »</a></p>'; if($x) echo '<p>There are no new announcements.</p>'; ?> Just change the YOURHOSTNAME to yours and make sure you use the correct directory of your whmcs, mine is listed as billing. Goodluck 0 Quote Link to comment Share on other sites More sharing options...
ssdindia Posted October 2, 2010 Share Posted October 2, 2010 Still not working.. 0 Quote Link to comment Share on other sites More sharing options...
tjmartin Posted October 2, 2010 Share Posted October 2, 2010 You have your page set as "index.php" and the code isnt working? You changed you path names to reflect your hosting correctly? If you want.. you can jump on my site and use our live chat and I can try to help you through there. Its easier than having lengthly posts. What is your domain where you are adding latest announcements? 0 Quote Link to comment Share on other sites More sharing options...
luangjokaj Posted November 7, 2010 Share Posted November 7, 2010 Im using this for my homepage, but im running my web in 2 languages. And i have 2 home pages. In English is working in second language is not working. (Im using just 2 languages). $result = mysql_query("SELECT * FROM tblannouncements WHERE published=' ' ORDER BY id DESC LIMIT ".$limit); The text is apparing good but the date and the link is not working? Any idea? 0 Quote Link to comment Share on other sites More sharing options...
luangjokaj Posted November 8, 2010 Share Posted November 8, 2010 Im using this for my homepage, but im running my web in 2 languages. And i have 2 home pages. In English is working in second language is not working. (Im using just 2 languages). $result = mysql_query("SELECT * FROM tblannouncements WHERE published=' ' ORDER BY id DESC LIMIT ".$limit); The text is apparing good but the date and the link is not working? Any idea? Anyone know how to fix that? 0 Quote Link to comment Share on other sites More sharing options...
Anders Posted August 30, 2011 Share Posted August 30, 2011 i am also interested about this. Anyone please help us novice coders. warm regards Anders 0 Quote Link to comment Share on other sites More sharing options...
mec Posted September 21, 2011 Share Posted September 21, 2011 http://blockserver.net/index.php any idea on how to make the actual announcement clickable when its echo'd so you can go directly to it? 0 Quote Link to comment Share on other sites More sharing options...
DTSleech Posted July 1, 2012 Share Posted July 1, 2012 To solve this and make both the user script in here, as well as the WHMCS script work, replace <?php with {php} and ?> with {/php} 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.