-
-
Notifications
You must be signed in to change notification settings - Fork 4
Binding objects
Greg Bowler edited this page Jan 27, 2023
·
14 revisions
// Most basic data structure: associative array. Key value pairs.
// Objects can be used instead of associative arrays, but plain objects don't bring any benefits.
// What's useful is to use instances of your project's classes. With the right application design, many steps can be avoided between the data coming from a database to being bound to the page.
// StdClass is an object with public properties.
// Binding an instance of a User
with public readonly properties.
// #[Bind("bindProperty")] attribute
// #[BindGetter] attribute for automatic
Next, learn how to template pages using Partial HTML.
PHP.Gt/DomTemplate is a separately maintained component of PHP.Gt/WebEngine.
- Bind data to HTML elements with
data-bind
attributes - Bind key modifiers
- Inject data into HTML with
{{curly braces}}
- Bind lists of data with
data-list
attributes - Bind nested lists with
data-bind:list
- Automatically remove unbound elements with
data-element
- Bind tabular data into HTML tables
- Using objects to represent bindable data