[Cppcms-users] Local variables in template
Brought to you by:
artyom-beilis
|
From: Tolga H. <fas...@gm...> - 2015-01-19 20:02:23
|
Hello, First of all thanks for this great project. It works flawlessly and it is well designed. I looked through the documentation but I could not find anything about declaring and using local variables in templates. My exact use case is a boost::optional variable used as: <div style="(<% if (const auto var = object->test()) %>property: <%= *var %>;<% end %>)"></div> where object->test() returns a boost::optional<std::string>. The problem is that inside the if statement, *var is automatically replaced with *content.var. Is there a way to prevent this? What is the correct way of this kind of usage? Thanks. |