Strother Posted November 15, 2012 Share Posted November 15, 2012 WHMCS has the following code in their docs at http://docs.whmcs.com/Linking_to_WHMCS. <?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>'; } ?> Unfortunately it seems to have something missing or coded wrong. Running it returns the following: '.$date.' - '.$title.' '.$announcement.' '; } ?> Any ideas how to patch this snippet? 0 Quote Link to comment Share on other sites More sharing options...
bear Posted November 15, 2012 Share Posted November 15, 2012 Is "support/dbconnect.php" the right path for your environment and the page it's being called from? That path needs to match where your WHMCS installation is, and if it's echoing out only the var names and not the data, that may be why. Strange it's including "'; } ?>" also, though. That shouldn't be there in that case. Is it possible the file was corrupted on upload, or the editor you'd used added in odd line breaks? 0 Quote Link to comment Share on other sites More sharing options...
Strother Posted November 15, 2012 Author Share Posted November 15, 2012 Yes, as described in the "How To" from WHMCS I have updated those two lines to direct it to my whmcs directory. I also had suspected the editor was tinkering with the code, but I have since tried it with three different editors with the same output. 0 Quote Link to comment Share on other sites More sharing options...
Alistair Posted November 15, 2012 Share Posted November 15, 2012 Are you trying to display it on a WHMCS template page? Or another site, such as an HTML or Word Press template? 0 Quote Link to comment Share on other sites More sharing options...
Strother Posted November 15, 2012 Author Share Posted November 15, 2012 On my website, sharing the same domain as whmcs. 0 Quote Link to comment Share on other sites More sharing options...
bear Posted November 15, 2012 Share Posted November 15, 2012 I also had suspected the editor was tinkering with the code, but I have since tried it with three different editors with the same output. What program and upload method are you using on the file (BINARY vs ASCII)? Whichever one, try the other. Some FTP programs default to one or the other and can introduce issues that way. It's echoing so PHP is parsing it, that leaves corruption as my main suspicion. 0 Quote Link to comment Share on other sites More sharing options...
Strother Posted November 15, 2012 Author Share Posted November 15, 2012 I am using filezille, which was set to auto. When I changed it to ascii the file uploaded and can now be executed. However, now we have new output, which is even more peculiar. When that code is executed, here is what gets returned: [ATTACH=CONFIG]4150[/ATTACH] So, it still seems there is something amiss in the code provided by Whmcs. 0 Quote Link to comment Share on other sites More sharing options...
bear Posted November 15, 2012 Share Posted November 15, 2012 The image showed "down for maintenance", but now the attachment isn't working. Unless your install also shows this, something else is going on here. http://docs.whmcs.com/Common_Troubleshooting_Tips#Down_for_Maintenance_-_An_upgrade_is_currently_in_progress 0 Quote Link to comment Share on other sites More sharing options...
Strother Posted November 15, 2012 Author Share Posted November 15, 2012 Not sure what happened to the image, I've attached it here again. At current, the code is only on one page of my site, and its not a WHMCS page. When I open that page, I get the "down for maintenance" response. If I remove the code, the page loads fine. Further, while the code is on that page, other pages, including whmcs pages, load just fine. I'm running 5.1.2. Is anyone running this code on their own site with success? 0 Quote Link to comment Share on other sites More sharing options...
bear Posted November 15, 2012 Share Posted November 15, 2012 Is anyone running this code on their own site with success? Well, I am, but I'm not using the latest version of WHMCS, it's one back. Mine doesn't call the DB since that gets called in another file on that same page, but other than a few minor changes it works on mine. The function call uses the full path, not a relative path: @include("/home/cpaneluser/www/whmcs-dir/includes/functions.php"); Have you tried that for both calls in yours? 0 Quote Link to comment Share on other sites More sharing options...
Strother Posted November 15, 2012 Author Share Posted November 15, 2012 I'm not using the latest version of WHMCS, it's one back. Ah, those were the days! 0 Quote Link to comment Share on other sites More sharing options...
Strother Posted November 15, 2012 Author Share Posted November 15, 2012 The function call uses the full path, not a relative path: @include("/home/cpaneluser/www/whmcs-dir/includes/functions.php"); Have you tried that for both calls in yours? Just tried that, same result "Down for maintenance". Baffling. 0 Quote Link to comment Share on other sites More sharing options...
bear Posted November 15, 2012 Share Posted November 15, 2012 Ah, those were the days! I've made it a rule that I never update to new releases until I see almost no complaints or bug reports. This one had some problems early on, so I held off. Just tried that, same result "Down for maintenance". Baffling. I agree. Since mine works using the same code and yours does not, that implies it's an issue with your environment more than an issue with the script/code, I'd suggest. Have you looked into using error reporting to see if maybe it's not connecting to the DB? Not sure if this would reveal anything useful, but: http://docs.whmcs.com/Blank_Pages (I know it's not a blank page, but it shows the error reporting step). 0 Quote Link to comment Share on other sites More sharing options...
Strother Posted November 15, 2012 Author Share Posted November 15, 2012 I'm moving on. Will just use rss to import the articles. Thanks for all the suggestions. 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.