Page 1 of 1
Working with smarty templaes
Posted: Sun Apr 02, 2006 5:36 pm
by calguy1000
When working with smarty templates in your modules , it's useful to know what variables are available and their values. Fortunately, this is now possible.
Create a user define tag called get_template_vars, here's the code for it:
Code: Select all
// get a list of all of the smarty assigned variables
// user defined tag named "get_template_vars"
global $gCms;
$tpl_vars = $gCms->smarty->get_template_vars();
print_r( $tpl_vars );
Then place {get_template_vars} at the bottom of the template you're working on, you'll get a list of all of the variables smarty knows about, and their values, and you can customize the template to your hearts content.
Hope this helps everybody.
Re: Working with smarty templaes
Posted: Sun Apr 02, 2006 7:13 pm
by Ted
Maybe this would be a good thing to automatically do when CMSMS is in debug mode. Toss it right at the bottom of the template processing functions...
Re: Working with smarty templaes
Posted: Sun Apr 02, 2006 7:28 pm
by tsw
what about smarty debug console?
while testing gallery2 and its debug mode it opens a popup window with smarty information..
http://tsw.backspace.fi/clean/cmsmadesi ... y/main.php
didnt check where its invoked though
Re: Working with smarty templaes
Posted: Sun Apr 02, 2006 9:13 pm
by Ted
Weird. Everytime I try the smarty debug console, it never works. I imagine I'm probably not doing something right in the smarty setup in cmsms...
Re: Working with smarty templaes
Posted: Mon Apr 03, 2006 8:56 am
by petert
Ted wrote:
Weird. Everytime I try the smarty debug console, it never works.
pop-up blocker?
Re: Working with smarty templaes
Posted: Sun Apr 23, 2006 9:01 pm
by amygdela
I got this:
[php]
Array ( [SCRIPT_NAME] => /index.php [app_name] => CMS )
[/php]
Doesn't seem all to much informative to me? Am I doing something wrong?
Re: Working with smarty templaes
Posted: Mon May 08, 2006 4:30 am
by Elijah Lofgren
amygdela wrote:
I got this:
[php]
Array ( [SCRIPT_NAME] => /index.php [app_name] => CMS )
[/php]
Doesn't seem all to much informative to me? Am I doing something wrong?
Upgrade to 0.13 beta 2 and it should work. See:
http://forum.cmsmadesimple.org/index.ph ... 471.0.html