Basic Examples with the Template Service.
This demonstrates how to use the new TemplateService on Kit.Template
.
⬇️ Result | Source ➡️
Use Quick and simple Parse(...)
-
Template:
It's already [DateTime:Now]
Result: It's already 11/22/2024 5:07:27 AM -
Template:
It's already [DateTime:Now|yyyy-MM-dd HH:mm:ss]
Result: It's already 2024-11-22 05:07:27 -
Template:
The current tutorial is [QueryString:tut]
Result: The current tutorial is templateservice -
Template:
The current URL is [Request:Url]
Result: The current URL is
⬇️ Result | Source ➡️
Use a Function based Source
-
Template:
I just wanted to say [Hello:World]
Result: I just wanted to say Hello World from a function -
Template:
[Hello:John] [Bye:Samantha]
Result: Hello John from a function Goodbye Samantha from a function
⬇️ Result | Source ➡️
Use a Dictionary based Source
-
Template:
<strong>[Values:Greeting]</strong> <br> <em>[Values:Intro]</em>
-
Result:
<strong>Hello there 👋🏾</strong> <br> <em>This is a simple dic-sample</em>
-
Result Raw:
<strong>Hello there 👋🏾</strong> <br> <em>This is a simple dic-sample</em>
⬇️ Result | Source ➡️
Use a Entity/Item based Source
-
Template:
<strong>[Person:FirstName] [Person:LastName]</strong> <br> <em>Fav. Number: [Person:FavoriteNumber]</em>
-
Result:
<strong>Douglas Adams</strong> <br> <em>Fav. Number: 41.99</em>
-
Result Raw:
<strong>Douglas Adams</strong> <br> <em>Fav. Number: 41.99</em>
⬇️ Result | Source ➡️
Use Item-Source with Template in another Item
-
Template:
<p><strong>[Person:FirstName] [Person:LastName]</strong><br><em>[Person:Introduction||...is a great author!]</em></p>
-
Result:
<p><strong>Douglas Adams</strong><br><em>...is a great author!</em></p>
-
Result Raw HTML using Html(..., tweak: ...)
<p><strong>Douglas Adams</strong><br><em>...is a great author!</em></p>
⬇️ Result | Source ➡️
Use Item-Source with Template in another Item
-
<p><strong>Douglas Adams</strong><br><em>...is a great author!</em></p>
-
<p><strong>Terry Pratchett</strong><br><em>...is a great author!</em></p>
-
<p><strong>Neil Gaiman</strong><br><em>...is a great author!</em></p>
-
<p><strong>George Akerlof</strong><br><em>...is a great author!</em></p>
-
<p><strong>Raphael Müller (not an author)</strong><br><em>...is a great author!</em></p>
-
<p><strong>Ed Hardy</strong><br><em>...is a great author!</em></p>
⬇️ Result | Source ➡️
Use Merge to combine 2 sources
-
<p><strong>Douglas 💫 Adams</strong><br><em>is an awesome 🦾 author!</em></p>
-
<p><strong>Terry 💫 Pratchett</strong><br><em>is an awesome 🦾 author!</em></p>
-
<p><strong>Neil Gaiman</strong><br><em>...is a great author!</em></p>
-
<p><strong>George Akerlof</strong><br><em>...is a great author!</em></p>
-
<p><strong>Raphael Müller (not an author)</strong><br><em>...is a great author!</em></p>
-
<p><strong>Ed Hardy</strong><br><em>...is a great author!</em></p>