← ClaudeAtlas

boxlang-templatinglisted

Use this skill when writing BoxLang markup templates (.bxm files), mixing HTML with BoxLang output expressions, using template components like bx:output, bx:loop, bx:if, bx:include, bx:script, building views, or creating any HTML-generating template files.
ortus-boxlang/skills · ★ 0 · Web & Frontend · score 58
Install: claude install-skill ortus-boxlang/skills
# BoxLang Templating Language ## Overview BoxLang's templating language uses `.bxm` files (BoxLang Markup) to mix HTML with dynamic server-side code. The default mode in `.bxm` files is HTML output — you embed BoxLang logic using `<bx:*>` tags and output expressions with `#expression#`. --- ## File Types Recap | Extension | Default mode | Primary use | |-----------|-------------|-------------| | `.bx` | Script | Classes, services, models | | `.bxs` | Script | Standalone scripts, CLI tools | | `.bxm` | Tag/markup | Templates, views, HTML pages | --- ## Output Expression Syntax Use `#expression#` to interpolate values. The expression is evaluated and output is HTML-escaped automatically inside `<bx:output>`: ```html <bx:output> <h1>Hello, #user.name#!</h1> <p>Today is #dateFormat( now(), "long" )#</p> <p>Items: #order.items.len()#</p> </bx:output> ``` **Always wrap output in `<bx:output>`** — without it, `#variable#` is treated as a literal string and not evaluated: ```html <!-- BAD: #name# is printed as literal text, not evaluated --> <p>#name#</p> <!-- GOOD: #name# is evaluated and output --> <bx:output><p>#name#</p></bx:output> ``` --- ## Core Template Components ### `<bx:output>` — Render Dynamic Content ```html <bx:output> <p>User: #user.firstName# #user.lastName#</p> <p>Email: #encodeForHTML( user.email )#</p> </bx:output> ``` Options: - `encodeFor="html"` — auto-encode all expressions (recommended for untrusted data) ```html <!-- Aut