YooSERV Posted July 27, 2009 Share Posted July 27, 2009 Hello how can I add php codes in .tpl files while creating my own pages? Thank you =) 0 Quote Link to comment Share on other sites More sharing options...
DataHosts Posted July 27, 2009 Share Posted July 27, 2009 (edited) http://wiki.whmcs.com/Template_Syntax It must be enclosed with {php} {/php} Also: http://smarty.net/manual/en/ Edited July 27, 2009 by DataHosts Added Smarty Site 0 Quote Link to comment Share on other sites More sharing options...
YooSERV Posted July 29, 2009 Author Share Posted July 29, 2009 Thanks it works ! But what can I do for that : <?= $message; ?> {php}= $message... ?? 0 Quote Link to comment Share on other sites More sharing options...
DedicatedPros Posted July 29, 2009 Share Posted July 29, 2009 Thanks it works ! But what can I do for that : <?= $message; ?> {php}= $message... ?? I'm not sure if what you're trying, but if it's just echo then: {php} $message = "this is my text"; echo $message; {/php} 0 Quote Link to comment Share on other sites More sharing options...
YooSERV Posted July 29, 2009 Author Share Posted July 29, 2009 Thanks for answer, it works =) And what about $mail = $clientsdetails.mail; does it works? It's to get the client's mail. 0 Quote Link to comment Share on other sites More sharing options...
DedicatedPros Posted July 29, 2009 Share Posted July 29, 2009 (edited) Well that's a bit tougher because the whmcs files are encoded, here's what I recommend doing (it also depends where you place this code, but we'll see about that later ): {php} $whmcs_path = '/complete/whmcs/path/here/'; require($whmcs_path . 'configuration.php'); $db = new mysqli($db_host, $db_username, $db_password, $db_name); $details = $this->get_template_vars('clientsdetails'); $sql = "SELECT email FROM tblclients WHERE id='". $details['id'] ."'"; $email = $db->query($sql)->fetch_object()->email; echo $email; {/php} That code will fetch the email directly from the MySQL database, the whmcs location is required to tell the script where to get the configuration file (it needs the username/pass and name of the database to fetch the email). Note that the path needs to be the full one, meaning something like /home/user/public_html/whmcs_dir/ Edited July 29, 2009 by DedicatedPros 0 Quote Link to comment Share on other sites More sharing options...
YooSERV Posted July 29, 2009 Author Share Posted July 29, 2009 Thank you for your help, everything is working now 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.