aboutsummaryrefslogtreecommitdiff
path: root/examples/template-demo/templates/index.html
diff options
context:
space:
mode:
Diffstat (limited to 'examples/template-demo/templates/index.html')
-rw-r--r--examples/template-demo/templates/index.html49
1 files changed, 49 insertions, 0 deletions
diff --git a/examples/template-demo/templates/index.html b/examples/template-demo/templates/index.html
index 837688f..2a08485 100644
--- a/examples/template-demo/templates/index.html
+++ b/examples/template-demo/templates/index.html
@@ -40,6 +40,55 @@
{{endfor}}
</ul>
+ <h2>Conditional Statements (if/elif/else)</h2>
+
+ <h3>Simple truthy check</h3>
+ <p>
+ {{if user_logged_in}}
+ <span class="highlight">User is logged in!</span>
+ {{else}}
+ <span>User is NOT logged in.</span>
+ {{endif}}
+ </p>
+
+ <h3>Equality check (role == "admin")</h3>
+ <p>
+ {{if role == "admin"}}
+ <span class="highlight">Welcome, Admin! You have full access.</span>
+ {{elif role == "user"}}
+ <span>Welcome, User! You have standard access.</span>
+ {{else}}
+ <span>Welcome, Guest! You have limited access.</span>
+ {{endif}}
+ </p>
+
+ <h3>Not equal check (status != "inactive")</h3>
+ <p>
+ {{if status != "inactive"}}
+ <span class="highlight">Account is active.</span>
+ {{else}}
+ <span>Account is inactive.</span>
+ {{endif}}
+ </p>
+
+ <h3>Variable existence check (exists)</h3>
+ <p>
+ {{if exists username}}
+ <span class="highlight">Username exists!</span>
+ {{else}}
+ <span>Username does NOT exist.</span>
+ {{endif}}
+ </p>
+
+ <h3>Variable existence check (not exists)</h3>
+ <p>
+ {{if not exists missing_var}}
+ <span class="highlight">missing_var does NOT exist (as expected)</span>
+ {{else}}
+ <span>missing_var exists (unexpected!)</span>
+ {{endif}}
+ </p>
+
<div class="footer">
<p>Rendered at: {{timestamp}}</p>
</div>