Jump to:

17452 Posts in 4473 Topics by 1971 members

Archive

SilverStripe Forums » Archive » Variable Dump / Handling Template Variables?

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

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

Page: 1
Go to End
Author Topic: 2945 Views
  • MattKenefick
    Avatar
    Community Member
    13 Posts

    Variable Dump / Handling Template Variables? Link to this post

    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.

  • ajshort
    Avatar
    Community Member
    244 Posts

    Re: Variable Dump / Handling Template Variables? Link to this post

    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

  • Willr
    Avatar
    Forum Moderator
    5489 Posts

    Re: Variable Dump / Handling Template Variables? Link to this post

    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

    2945 Views
Page: 1
Go to Top

Want to know more about the company that brought you SilverStripe? Then check out SilverStripe.com

Comments on this website? Please give feedback.