BAJI26 Posted September 13, 2015 Share Posted September 13, 2015 I would like to add some php on the header.tpl and footer.tpl to display some info from the DB. I tried {php} but its giving some errors. What would be the best way to add it? <?php require("init.php"); require("includes/functions.php"); if ($_SESSION['uid']) { $query="SELECT * FROM tbl** WHERE id='" .sanitize($_SESSION['**']) . "'"; $result = mysql_query($query) or die(mysql_error()); if($row = mysql_fetch_array($result, MYSQL_ASSOC)) { ?> 0 Quote Link to comment Share on other sites More sharing options...
sentq Posted September 13, 2015 Share Posted September 13, 2015 use ClientAreaPage Action Hook instead 0 Quote Link to comment Share on other sites More sharing options...
BAJI26 Posted September 15, 2015 Author Share Posted September 15, 2015 I want to put the announcements in whmcs pages with the same styling as what I have on my external pages! I have a custom query to the database which pulls them and I want to add the same coding to the footer.tpl. 0 Quote Link to comment Share on other sites More sharing options...
brian! Posted September 15, 2015 Share Posted September 15, 2015 have you tried the code in the documentation ? http://docs.whmcs.com/Linking_to_WHMCS#Displaying_Announcements_on_your_Site 0 Quote Link to comment Share on other sites More sharing options...
BAJI26 Posted September 15, 2015 Author Share Posted September 15, 2015 Yea and it messed the page, it actually removed the entire footer. 0 Quote Link to comment Share on other sites More sharing options...
brian! Posted September 15, 2015 Share Posted September 15, 2015 Yea and it messed the page, it actually removed the entire footer. if you were using it on a page within your whmcs site, e.g footer or header, you should remove the 'members' bit of the first line. require_once 'init.php'; if you do that, it should work - I just pasted that code into six/footer.tpl and it works fine - if that path is wrong, it blank the screen. that said, as sentq suggested, you'd probably be better off using an action hook (or data feed) - i'd avoid using {php} in the templates now unless absolutely necessary. with a data feed, you really only need to know two things - the SQL query and how you want to display the output - you say you already have the query, and you know how you want it to look, so it should be relatively straightforward to create the feed. 0 Quote Link to comment Share on other sites More sharing options...
freemind Posted September 16, 2015 Share Posted September 16, 2015 Settings > Security > Allow Smarty PHP Tags "ENABLE" 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.