17488 Posts in 4473 Topics by 1978 members
|
Page:
1
|
Go to End | |
| Author | Topic: | 2301 Views |
-
Variable Dump / Handling Template Variables?

26 August 2008 at 3:00am
In Smarty, there's a way to enable a debugging screen that'll tell you all the variables being passed to the template. Is there such a thing with this?
If no one told me that $Layout, $Forms, $SilverStripeNavigator and whatever else were variables, I'd have no idea... Is there something I can see that with?
---------------
Also.. When I pass a variable to the template files, or use an existing one... Is there a way to manipulate it in the template? I've been experiencing the two following issues:
1.) What if I want to send a string like $Breadcrumbs to all Uppercase or all Lowercase?
2.) If I insert a variable into an image tag or such, it won't read it. I've been having to use a PHP tag hack to get around it:: <img src="tutorial/images/nav/nav_$MenuTitle<?php ?>.gif">
If I remove the PHP tags, it thinks the variable is $MenuTitle.gif
Thanks.
-
Re: Variable Dump / Handling Template Variables?

26 August 2008 at 10:14am
Hi Matt,
the closest thing to a template debugger in SilverStripe is if you use the $Debug variable in your template. This will print out all available methods.
As for your other questions:
1) You should use CSS for this: text-transform:uppercase;
2) Try something like {$MenuTitle}.gif -
Re: Variable Dump / Handling Template Variables?

26 August 2008 at 12:01pm
Theres a list of options on http://doc.silverstripe.com/doku.php?id=built-in-page-controls&s=page%20controls#quick_reference too which has all the default methods you can call.
I might make up a nice little handy quick reference PDF with all the various options if this rain continues into the weekend
| 2301 Views | ||
|
Page:
1
|
Go to Top |



