Skip to content

Better support for ternary operator #881

@wisskid

Description

@wisskid

Smarty has support for the ternary operator since 2009/2010. But it was never documented. Also, it requires the testing expression to be in parentheses. So this works now:

{($foo) ? $var1 : $var2}

But this will not:

{$foo ? $var1 : $var2}

There is no support for the shorthand ?: version.

  • Change the implementation to make the parentheses optional
  • Support the shorthand version as well
  • Document the implementation

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions