CMS Made Simple Forums
https://forum.cmsmadesimple.org/

Debug a template on a live site using a smarty conditional.
https://forum.cmsmadesimple.org/viewtopic.php?f=4&t=61152
Page 1 of 1

Author:  scooper [ Thu May 17, 2012 1:50 pm ]
Post subject:  Debug a template on a live site using a smarty conditional.

I just had to fix a templating issue on a live site and wanted to use var_dump to see what smarty info was available.

Obviously I didn't want that information showing up on the live site so I put in a smarty conditional that checked for a query parameter

\$1:
{if $smarty.get.debug eq 1}

//whatever code you want to see here.
{get_template_vars}

{/if}


Then you can just add a query parameter to the URL and you'll see the code in the conditional and your users won't.

So
http://www.millipedia.co.uk/stuff/debugging-smarty.html is what your users see but
http://www.millipedia.co.uk/stuff/debugging-smarty.html?debug=1 is what you see.

Hope that's useful to someone.

s.

Author:  manuel [ Thu May 17, 2012 4:03 pm ]
Post subject:  Re: Debug a template on a live site using a smarty condition

Dear Scooper,

Thanks for sharing!
A quick and elegant solution, i will be using it on my live sites for sure! :)

Greetings,
Manuel

Author:  manuel [ Tue Jul 31, 2012 8:50 pm ]
Post subject:  Re: Debug a template on a live site using a smarty condition

And i just did :)
thx again!

Greetings,
Manuel

Page 1 of 1 All times are UTC
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
http://www.phpbb.com/