PHP Templates
Using PHP files in the templates directory
Overview
File Location
com.yourcompany.component/
├── templates/
│ ├── index.html
│ ├── handler.php # PHP template (rare at root level)
│ └── backend/ # More common location for PHP
│ └── process.phpWhen to Use PHP Templates
Root-Level PHP (Uncommon)
Backend PHP (Recommended)
Basic Usage
Property Insertion in PHP
Processing Behavior
Template Processing First
Backend Directory (Recommended Pattern)
Limitations
Template Processing Only
Security Considerations
Common Patterns
Form Processing
API Endpoints
Configuration Files
Best Practices
Use Backend Directory
Pass Configuration from Properties
Separate Logic from Configuration
Handle Errors Gracefully
Templates vs Assets
Use templates/backend/ When:
templates/backend/ When:Use Shared Assets When:
Related Documentation
Last updated
Was this helpful?

