Ferreteria/v0.5/feature/rendering: Difference between revisions
(Created page with "==About== The "Feature" concept encompasses all of the data in a specific table plus related data in other tables (but organized around the primary table). The most common mo...") |
No edit summary |
||
Line 10: | Line 10: | ||
==Process== | ==Process== | ||
The | The {{l/ver/class|taTemplated}} trait adds methods to manage template-strings for rendering each Row's data. | ||
The <code>ferreteria\data\rows\taDispDual</code> trait (which uses <code>taTemplated</code>) adds methods to the {{l/ver|portrow/disp|Display PortRow}} (just "PortRow" henceforth) support dual-mode display. The basic idea is that instead of a single {{l/ver|portcard/disp|Card}} class being summoned for handling each Row, we now have two Card classes -- one each for LINE mode and PAGE mode. The PortRow then iterates through the rowset it's given (which should only contain one row if PAGE mode is desired), summon a Card of the appropriate class for each Row, and ask the Card to render itself. | The <code>ferreteria\data\rows\{{l/ver/class|taDispDual}}</code> trait (which uses <code>taTemplated</code>) adds methods to the {{l/ver|portrow/disp|Display PortRow}} (just "PortRow" henceforth) support dual-mode display. The basic idea is that instead of a single {{l/ver|portcard/disp|Card}} class being summoned for handling each Row, we now have two Card classes -- one each for LINE mode and PAGE mode. The PortRow then iterates through the rowset it's given (which should only contain one row if PAGE mode is desired), summon a Card of the appropriate class for each Row, and ask the Card to render itself. | ||
The PortRow will also handle the display of headers and footers, though for PAGE mode these can be empty strings because the Card can render them just as easily. | The PortRow will also handle the display of headers and footers, though for PAGE mode these can be empty strings because the Card can render them just as easily. |
Latest revision as of 22:19, 11 December 2022
About
The "Feature" concept encompasses all of the data in a specific table plus related data in other tables (but organized around the primary table).
The most common modes for displaying Feature data (both of which are supported by Ferreteria classes and traits) are:
- line: each row of a rowset is formatted in a way that is friendly towards multiple rows being displayed at once.
- Typically, each row is displayed as a row in an HTML table.
- The rowset may be (and often is, for some Features) all of the rows in the Feature's table.
- The rowset may be filtered by one or more fields within the table; we may sometimes want to hide columns whose value is known and fixed.
- page: we are looking at just one row, and want to see as much information as possible -- so the information is formatted to fill a page, possibly including related data from other tables.
Process
The taTemplated trait adds methods to manage template-strings for rendering each Row's data.
The ferreteria\data\rows\taDispDual
trait (which uses taTemplated
) adds methods to the Display PortRow (just "PortRow" henceforth) support dual-mode display. The basic idea is that instead of a single Card class being summoned for handling each Row, we now have two Card classes -- one each for LINE mode and PAGE mode. The PortRow then iterates through the rowset it's given (which should only contain one row if PAGE mode is desired), summon a Card of the appropriate class for each Row, and ask the Card to render itself.
The PortRow will also handle the display of headers and footers, though for PAGE mode these can be empty strings because the Card can render them just as easily.
LINE mode
The PortRow accumulates the (string) output from these methods, in this order, and returns it (as a single string):
$this->RenderRows_start()
$this->RenderRows_head()
$this->RenderRows_data()
--taDispDual
provides the functionality to iterate through the Storage Rowset, doing the following for each Row:- transload the Row into the Display PortRow
- call
$this->RenderContent()
- by default this is implemented by
taTemplated
, which:- retrieves the Template to use (which is ultimately determined by the Card class)
- sets the values for the Template to use
- asks the Template to render itself, and returns the resulting value (as a string) - 2022-06-01 This part of the process still needs some work.
- by default this is implemented by
$this->RenderRows_finish()