Cheap Shared Hosting

Tuesday, June 24, 2008

Quick Smarty tip - Restricting when the debug console is shown

Another tip for those who have to work on live servers. The debug console is quite handy if you're using the smarty templating engine - but probably not something that should be shown to "real" users. So, an easy fix is to restrict it to be shown to only traffic coming from your IP address, like so:

{if $smarty.server.REMOTE_ADDR == "[your ip address]"}
{debug}
{/if}

No comments: