#2377 - Tempcode optimisation - conditional parameter generation
| Identifier | #2377 |
|---|---|
| Issue type | Feature request or suggestion |
| Title | Tempcode optimisation - conditional parameter generation |
| Status | Closed (rejected) |
| Tags |
Type: Performance (custom) |
| Handling member | Chris Graham |
| Addon | core |
| Description | Don't generate and pass parameters into templates that we think may not be used...
Example: BOX attribute for CNS_MEMBER_DIRECTORY_USERNAME may not be used in final template if the box tooltips are disabled, but is very heavy load so we don't want to generate it and carry it in the tree if not needed Create a template_may_use($template, $parameter) function template_may_use will work by having the run-time template cache prepped and querying the unbound Tempcode object within it; do_template and template_may_use may now both use a common function that does that cache prepping, to simplify the do_template code Make a temporary scanner to log all unused parameters so that we can mass-correct across the code-base template_may_use has to be aware that INCLUDE directives's may change what parameters are used - it has to be able to recurse into them |
| Steps to reproduce | |
| Additional information | Particularly see all the stuff put into catalogue templates, e.g....
// Different ways of accessing the main field value, and pure version of it $field_name = get_translated_text($field['cf_name']); //$map['FIELDNAME_' . $str_i] = $field_name; //$fields_2d[] = array('NAME' => $field_name, 'VALUE' => $use_ev); $field_type = $field['cf_type']; //$map['FIELDTYPE_' . $str_i] = $field_type; $map['FIELD_' . $str_i] = $use_ev; $map['_FIELD_' . $str_id] = &$map['FIELD_' . $str_i]; if ($use_ev === $ev) { $map['FIELD_' . $str_i . '_PLAIN'] = &$map['FIELD_' . $str_i]; } else { $map['FIELD_' . $str_i . '_PLAIN'] = $ev; } $map['_FIELD_' . $str_id . '_PLAIN'] = &$map['FIELD_' . $str_i . '_PLAIN']; if ($ev === $field['effective_value_pure']) { $map['FIELD_' . $str_i . '_PURE'] = &$map['FIELD_' . $str_i . '_PLAIN']; } else { $map['FIELD_' . $str_i . '_PURE'] = $field['effective_value_pure']; } $map['_FIELD_' . $str_id . '_PURE'] = &$map['FIELD_' . $str_i . '_PURE']; |
| Funded? | No |
The system will post a comment when this issue is modified (e.g., status changes). To be notified of this, click "Enable comment notifications".

Comments
This is a cleaner solution.