Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

Archive /

Our old forums are still available as a read-only archive.

Moderators: martimiz, Sean, Ed, biapar, Willr, Ingo

Variable Dump / Handling Template Variables?

Go to End

3 Posts   4361 Views


Community Member, 13 Posts

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



Community Member, 244 Posts

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


Forum Moderator, 5523 Posts

26 August 2008 at 12:01pm

Theres a list of options on 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 :)