On 12/6/19 10:40 PM, selimozel wrote:
Hi There. This is my first post!
I am building a web application using Vibe-D. My source and diet templates are based on examples provided by the community.
I wonder if there is a way to write a simple function that returns an argument and call that function from a diet template. I checked calling embedded code section [1] but what I really want to have is to call functions from the source code directly.
[1] http://vibed.org/templates/diet#embedded-code
Yes, you can, just import the module that contains the function you need
to call. Then call it from D-mode.
e.g.:
- import std.stdio;
- writeln("hello, world!");
Now, when you render your diet template, the server should print hello
world to the console.
-Steve