Latte 3.1: When a templating system truly understands HTML – Nette Blog

This title could be clearer and more informative.Try out Clickbait Shieldfor free (5 uses left this month).

Latte 3.1 introduces Smart HTML Attributes that understand context and data types, eliminating unnecessary conditions in templates. The update brings native mapping of PHP types to HTML attributes where null removes attributes entirely, booleans control attribute presence, and arrays serialize automatically for class/style/data attributes. It includes runtime type checking to catch errors during development, enables strict types by default, and adds a nullsafe filter operator (?|) for handling null values gracefully. The release also introduces syntactic improvements like n:elseif and provides a migration mode to safely upgrade from version 3.0.

5m read timeFrom blog.nette.org
Post cover image
Table of contents
Native mapping of PHP types to HTML attributesType safety in templatesStrict Types by DefaultNullsafe filters: The Holy Grail for Strict TypesSyntactic sugar for cleaner codeHow to upgrade safely?
1 Comment

Sort: