I am aware of using INCLUDE to break a template into fragments that can be reused in multiple ways but this leads to many separate files that can become difficult to name and manage consistently. I am looking for a way to specify a subset of an existing template to be rendered. This could be any contained block, presumably identified by an id attribute on the containing tag. The invoking render statement might look like:
echo Template::instance()->renderFragment('main.html', '#user-form');
where '#user-form' identifies an embedded form in the larger template. This capability would mesh very well with HTMX ability to process elements at the tag level.
Answering my own question: I have created the required functionality using an HTML Parser package (paquettg/php-html-parser) and a simple function that returns a template partial.
Within the default Controller I have:
This solution successfully subsets any template to a block identified by an id.