skip to Main Content

Smarty Debug Code to only show content for your own ip address

Smarty Debug Code To Only Show Content For Your Own Ip Address

In Smarty templating code you sometimes just want to show content to a specific IP address. This is ideal for trying something on the live site but only you can see what is happening.


{if $smarty.server.REMOTE_ADDR == '141.105.193.53'}
{* other debugging code goes here *}
{/if}

Where 141.105.193.53 is your ip address.
To Get you IP address goto https://www.google.co.uk/search?q=my+ip+address

If you are using a Web Firewall such as Sucuri then you will need to use the following instead.


{if $smarty.server.HTTP_X_SUCURI_CLIENTIP == '141.105.193.53'}
{* other debugging code goes here *}
{/if}

For PHP it is

Back To Top