smarty-php / smarty

Smarty is a template engine for PHP, facilitating the separation of presentation (HTML/CSS) from application logic.
Other
2.22k stars 701 forks source link

value and name of backed enums #1012

Open SlowFox71 opened 2 months ago

SlowFox71 commented 2 months ago

As far as I can see, there is no support for things like:

<option id="{MyEnum::Foo->name}">{MyEnum::Foo->value}</option>

My last experience with parsers is more than a decade ago, and I didn't take the time to fully understand TemplateParser.y, but something like

static_class_access(res)       ::= ID(v) PTR ID(n). {
    res = array(v, '->'.n);
}   

IMO should do the trick.