I've got a PHP page that parses an XML file with SimpleXml, then passes that object to a Smarty template. My problem is that the XML file has hyphens in its tag names, e.g. video-player
. In PHP, this is no problem, I just use $xml->{'video-player'}
and everything's fine. Smarty, on the other hand, throws a fit when I try to use that syntax.
The only solution I've come up with so far is to use a variable to store the name, e.g.,
{ assign var=name value="video-player" }
{ $xml->$name }
But this isn't terribly graceful to say the least. Is there another, better, approach to referring to a hyphenated variable name in Smarty?