ryans Posted January 8, 2015 Share Posted January 8, 2015 (edited) I looked around at some content management systems for whmcs and they are nice but I don't quite feel like shelling out $30-50 so I decided to write my own. You can use your Announcement section to make pages for your whmcs. Here is how to do it. Create an announcement page and don't publish it. Once it's save mouse over and get the ID #. Remember the number. Then read this page and grab the code to create your php page. Lets say you want to create a page called business.php. Grab the code from that site and paste it into your text editor and name it business.php. Upload that file to your whmcs directory. Now create the template page. business.tpl Paste this code in there and just change ID=5 to whatever the ID is of your announcement page <div class="internalpadding announcements"> <div class="styled_title"> <h2>Business Solutions</h2> </div> <br><br> {php} $query = "SELECT * FROM `tblannouncements` WHERE `id` = 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 '<p>'.$announcement.'</p>'; } {/php} <br><br> </div> Upload the tpl file to your templates/theme folder. You can look at the other tpl files to get the page to look correctly. the go to http://yoursite/whmcs/business.php and it should show up. I even use this on my homepage. Edited January 8, 2015 by Infopro Modifed Title 0 Quote Link to comment Share on other sites More sharing options...
ryans Posted January 8, 2015 Author Share Posted January 8, 2015 I updated the script. Use this code and now you can pull up your articles with just like this: http://yoursite.com/whmcs/page.php?id=5 or 1 or 2, whatever your article ID is. {php} $query = "SELECT * FROM `tblannouncements` WHERE `id` = {$_GET['id']} "; $result = mysql_query($query); while ($data = mysql_fetch_array($result)) { $id = $_GET['id']; $date = $data["date"]; $title = $data["title"]; $announcement = $data["announcement"]; $date = fromMySQLDate($date); echo '<p>'.$announcement.'</p>'; } {/php} 0 Quote Link to comment Share on other sites More sharing options...
sentq Posted January 9, 2015 Share Posted January 9, 2015 you may need to change this: $query = "SELECT * FROM `tblannouncements` WHERE `id` = {$_GET['id']} "; to $id = intval($_GET['id']); $query = "SELECT * FROM `tblannouncements` WHERE `id` = {$id} "; to avoid SQL Injection. 0 Quote Link to comment Share on other sites More sharing options...
ryans Posted January 9, 2015 Author Share Posted January 9, 2015 I was actually wondering about that, was going to have a buddy check my code. thanks! 0 Quote Link to comment Share on other sites More sharing options...
ryans Posted October 1, 2015 Author Share Posted October 1, 2015 This doesn't work anymore. Anyone know why? Version 6.0 changed a lot. 0 Quote Link to comment Share on other sites More sharing options...
ryans Posted October 1, 2015 Author Share Posted October 1, 2015 I've updated the script for whmcs 6.0. http://forum.whmcs.com/showthread.php?106603-Create-pages-from-your-announcements-for-whmcs-6x&p=438151#post438151 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.