aboutsummaryrefslogtreecommitdiff
path: root/examples/template-demo/templates
diff options
context:
space:
mode:
authorfrosty <gabriel@bwaaa.monster>2026-03-12 18:13:04 -0400
committerfrosty <gabriel@bwaaa.monster>2026-03-12 18:13:04 -0400
commit4722542caf4192fe702adc975e8ee557e3526426 (patch)
treea9419dea2815652f3f53ab8d90009774494883fc /examples/template-demo/templates
parentec82c9ec4eb40ba28c228414e501d73ecc5326af (diff)
downloadbeaker-4722542caf4192fe702adc975e8ee557e3526426.tar.gz
feature: added conditionals + added examples
Diffstat (limited to 'examples/template-demo/templates')
-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>