Working with smarty templaes

Do something cool with CMS? Show us ...
This board is for 'Answers', and the discussion of answers... Not for questions.
Post Reply
calguy1000
Support Guru
Support Guru
Posts: 8169
Joined: Tue Oct 19, 2004 6:44 pm
Location: Fernie British Columbia, Canada

Working with smarty templaes

Post 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.
Follow me on twitter
Please post system information from "Extensions >> System Information" (there is a bbcode option) on all posts asking for assistance.
--------------------
If you can't bother explaining your problem well, you shouldn't expect much in the way of assistance.
Ted
Power Poster
Power Poster
Posts: 3329
Joined: Fri Jun 11, 2004 6:58 pm
Location: Fairless Hills, Pa USA

Re: Working with smarty templaes

Post 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...
tsw
Power Poster
Power Poster
Posts: 1408
Joined: Tue Dec 13, 2005 10:50 pm
Location: Finland

Re: Working with smarty templaes

Post 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
Ted
Power Poster
Power Poster
Posts: 3329
Joined: Fri Jun 11, 2004 6:58 pm
Location: Fairless Hills, Pa USA

Re: Working with smarty templaes

Post 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...
User avatar
petert
Power Poster
Power Poster
Posts: 282
Joined: Wed Feb 09, 2005 9:30 pm
Location: behind my desk

Re: Working with smarty templaes

Post by petert »

Ted wrote: Weird.  Everytime I try the smarty debug console, it never works.
pop-up blocker?
Mambo sucks, that's why I am here.
Now they call it Joomla, but it still sucks!

CMSMS rules!
amygdela

Re: Working with smarty templaes

Post 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?
User avatar
Elijah Lofgren
Power Poster
Power Poster
Posts: 811
Joined: Mon Apr 24, 2006 1:01 am
Location: Deatsville, AL

Re: Working with smarty templaes

Post 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
Note: I don't have time to take on any more projects. I'm quite busy. I may be too busy to reply to emails or messages. Thanks for your understanding. :)
Post Reply

Return to “Tips and Tricks”