DomTemplate
DomTemplate copied to clipboard
Idea: Component with its own PHP
If we have a custome-element.html
, why no custom-element.php
with its own go function?
A special case for the ServiceContainer could provide an HTMLElement already referencing the correct element.
This is how remix does it: https://remix.run/ - a custom element like <invoice-item>
can have its view in invoice-item.html
and logic in invoice-item.php
- the go
function will need to know what invoice is being referenced.
Two ideas on how to solve this:
- Use the dynamic path as before.
- Bind an attribute to the custom element, like an ID, from the page's
go
function.
For this to work with a single go()
function, another repository has to be maintained. This will be fine, but I'll defer it for now until there's more time to put onto this.
The other repository has to split out the functionality of php.gt/routing
's LogicStream, so a file can be loaded from gt-component-stream://
location. Currently this is hard-coded for use with Page Logic files, but should be expanded on to be generic, and shared with the loading of components.