Brian Murphy Posted August 29, 2012 Share Posted August 29, 2012 Hi, We are developers and ecommerce solution providers. I was just trying to post a contribution to the tips and tricks forum but found we could not create a topic (having never tried). Is it a post count threshold or something? Any advice? I'm not that fussed, but thought I'd contribute having found the forums so useful. Thanks for your time guys. Brian 0 Quote Link to comment Share on other sites More sharing options...
WHMCS Support Manager WHMCS John Posted August 29, 2012 WHMCS Support Manager Share Posted August 29, 2012 Hi, From the Tips and Tricks forum description: Found a different way of using WHMCS or something that you think would help others? If so, post elsewhere and we'll move it here. (closed to new threads) 0 Quote Link to comment Share on other sites More sharing options...
Brian Murphy Posted August 30, 2012 Author Share Posted August 30, 2012 The SMARTY features within WHMCS are very useful and when used correctly, powerful! Using SMARTY debugging "{debug}" in .TPL files, allows you to troubleshoot and see what variables and configuration settings are in use; dependant on the queries and pages being viewed. Debug is however NOT what you want your visitors and potential customers seeing! I did some research on the SMARTY website and came up with a simple solution! See the snippet below and place it either at the bottom of your frontend 'footer.tpl' or 'header.tpl' file: {if $loggedin gt 0} {* THIS IS TRIGGERED IF A CUSTOMER IS LOGGED IN. *} {debug} or insert your code here... {/if} {if $smarty.session.adminid gt 0} {* THIS IS TRIGGERED IF ADMIN X IS LOGGED IN. *} {debug} or insert your code here... {/if} Above, "gt" represents Greater Than, all the available options include: i) "gt" is 'greater than', or ">", ii) "eq" is 'equals', or "=", iii) "lt" is 'less than', or "<". As these variables are not set when a user or an admin is logged out (or equals 0) then we can simplify the equations to: {if $loggedin} {* THIS IS TRIGGERED IF A CUSTOMER IS LOGGED IN. *} {debug} or insert your own code here... {/if} {if $smarty.session.adminid} {* THIS IS TRIGGERED IF ADMIN X IS LOGGED IN. *} {debug} or insert your own code here... {/if} Now each of the IF statements are assuming that when the conditions are true, it will execute the debugging console. I hope you find it useful! If you would like to contribute by showing an example of how you implemented this, or something similar (or better!), then please share it here! Thanks. 0 Quote Link to comment Share on other sites More sharing options...
Brian Murphy Posted August 30, 2012 Author Share Posted August 30, 2012 The SMARTY features within WHMCS are very useful and when used correctly, powerful! Using SMARTY debugging "{debug}" in .TPL files, allows you to troubleshoot and see what variables and configuration settings are in use; dependant on the queries and pages being viewed. Debug is however NOT what you want your visitors and potential customers seeing! I did some research on the SMARTY website and came up with a simple solution! See the snippet below and place it either at the bottom of your frontend 'footer.tpl' or 'header.tpl' file: {if $loggedin gt 0} {* THIS IS TRIGGERED IF A CUSTOMER IS LOGGED IN. *} {debug} or insert your code here... {/if} {if $smarty.session.adminid gt 0} {* THIS IS TRIGGERED IF ADMIN X IS LOGGED IN. *} {debug} or insert your code here... {/if} Above, "gt" represents Greater Than, other available options available in Smarty include: "gt" or ">" is 'greater than', "eq" or "=" is 'equals', "lt" or "<" is 'less than', "ne" or "!=" is 'not equal', "ge" or ">=" is 'greater than or equal', "le" or "<=" is 'less than or equal'. As these variables are not set when a user or an admin is logged out (or equals 0) then we can simplify the equations to: {if $loggedin} {* THIS IS TRIGGERED IF A CUSTOMER IS LOGGED IN. *} {debug} or insert your own code here... {/if} {if $smarty.session.adminid} {* THIS IS TRIGGERED IF ADMIN X IS LOGGED IN. *} {debug} or insert your own code here... {/if} Now each of the IF statements are assuming that when the conditions are true, it will execute the debugging console. I hope you find it useful! If you would like to contribute by showing an example of how you implemented this, or something similar (or better!), then please share it here! Thanks. 0 Quote Link to comment Share on other sites More sharing options...
Brian Murphy Posted August 30, 2012 Author Share Posted August 30, 2012 (edited) Thank you John. Please disregard the second last / first post (#3). Have a great day. Edited August 30, 2012 by Brian Murphy 0 Quote Link to comment Share on other sites More sharing options...
WHMCS Support Manager WHMCS John Posted August 30, 2012 WHMCS Support Manager Share Posted August 30, 2012 Hi, Thanks for your contribution: http://forum.whmcs.com/showthread.php?57278 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.