-
-
Notifications
You must be signed in to change notification settings - Fork 5
Page partials
Partials are reusable HTML fragments that can be inserted into page views. They are a layout tool rather than a data-binding tool.
Unlike headers and footers, partials are not automatically applied to every page in a directory. Unlike custom HTML components, they are not intended to behave like named UI elements with their own focused element boundary. They are mainly for composing page structure from reusable pieces.
Partials help when repeated sections of markup would otherwise be copied between several pages. They also help keep large page views manageable, especially when several pages share a common skeleton but differ in content.
In other words, they are useful for layout composition.
Partial files live in the configured partial directory, which by default is page/_partial.
A page view can reference or extend partial content from there, allowing one file to provide the main layout while another fills in the page-specific parts. WebEngine expands those partials before the normal page binding and logic work is complete.
This means the final document shape is assembled first, and then the page logic can bind data into that assembled document.
Partials are a good fit for:
- shared page sections that are not global enough to be headers or footers
- layout fragments reused across one area of the application
- page skeletons that several views build upon
Use headers and footers when the framing is global or directory-wide. Use custom components when the repeated fragment behaves more like a reusable UI element. Use ordinary binding when the structure is fixed and only the values change.
Partials help shape the document before data is bound into it. That is why this page is about layout composition, not data binding.
The content within page views can be made dynamic by binding data to the DOM.
- File-based routing
- Page views
- Page logic
- Dynamic URIs
- Headers and footers
- Custom HTML components
- Page partials
- Binding data to the DOM
- DOM manipulation
- Hello You tutorial
- Todo list tutorial
- Address book tutorial WIP
- Blueprints
- Application architecture
- Coding styleguide WIP
- PHP environment setup WIP
- Web servers WIP
- Background cron tasks
- Database setup WIP
- Client-side compilation WIP
- Testing WebEngine applications WIP
- Production checklist WIP
- Security WIP