Test templates without breaking the frontend
Previous article Next articleYou need to do some tests at your website, but you don't want to break the frontend for the visitors.
A simple solution using Smarty.
How to use
Your current IP address is: 18.206.92.240
This way only you will see the template vars:
{get_template_vars}
{/if}
<!-- The template content -->
Another example, testing a module like CGFeedback without letting it show to the public.
{if $smarty.server.REMOTE_ADDR == '18.206.92.240'}
{CGFeedback key1=$foo key2=$bar}
{/if}
This content is only visible at the frontend when you are logged in into the Admin, it is hidden for regular visitors.
{if $uid > 0}
{get_template_vars}
{/if}
<-- The template content -->
Comment Form
1 Comment
I do a similar thing but with get variables. Eg
{if $smarty.server.get.test eq '1'}
{get_template_vars}
{/if}
And then add ?test=1 to the end of the url.