• twitter image
  • facebook image
  • youtube image
  • linkedin image
Language: CMS Made Simple Czech CMS Made Simple France CMS Made Simple Spain CMS Made Simple Hungary CMS Made Simple Russia CMS Made Simple Netherlands

All times are UTC




Post new topic Reply to topic  [ 3 posts ] 
Author Message
 Post subject: Debug a template on a live site using a smarty conditional.
PostPosted: Thu May 17, 2012 1:50 pm 
Offline
Forum Members
Forum Members
User avatar

Joined: Fri Dec 09, 2005 12:36 pm
Posts: 237
Location: Marlow, UK
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.


Top
  Profile  
 
Share On:
Share on Facebook Share on Twitter Share on Google+
 Post subject: Re: Debug a template on a live site using a smarty condition
PostPosted: Thu May 17, 2012 4:03 pm 
Offline
Dev Team Member
Dev Team Member
User avatar

Joined: Fri Nov 30, 2007 9:15 am
Posts: 350
Dear Scooper,

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

Greetings,
Manuel

_________________
Do you like your open source cms? Buy from the CMSMS partners || Donate
(or at least share some knowledge :D >> See some of my stuff )


Top
  Profile  
 
Share On:
Share on Facebook Share on Twitter Share on Google+
 Post subject: Re: Debug a template on a live site using a smarty condition
PostPosted: Tue Jul 31, 2012 8:50 pm 
Offline
Dev Team Member
Dev Team Member
User avatar

Joined: Fri Nov 30, 2007 9:15 am
Posts: 350
And i just did :)
thx again!

Greetings,
Manuel

_________________
Do you like your open source cms? Buy from the CMSMS partners || Donate
(or at least share some knowledge :D >> See some of my stuff )


Top
  Profile  
 
Share On:
Share on Facebook Share on Twitter Share on Google+
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 3 posts ] 

All times are UTC


Who is online

Users browsing this forum: No registered users


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Hosting Nation - Managed CMSMS Hosting