DomTemplate icon indicating copy to clipboard operation
DomTemplate copied to clipboard

Idea: Component with its own PHP

Open g105b opened this issue 2 years ago • 1 comments

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:

  1. Use the dynamic path as before.
  2. Bind an attribute to the custom element, like an ID, from the page's go function.

g105b avatar Feb 28 '22 17:02 g105b

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.

g105b avatar Oct 31 '22 17:10 g105b