Task #19604
Remove redundant or unnecessarily long references from template code
Description
Lots of template code has unnecessarily long and redundant references to simple variables that could be cleaned up to make the templates a lot less cluttered.
I'll post some specific examples in the comments section...
History
#1 Updated by John Diamond almost 3 years ago
For example, see source:/templates/linux/kernel/api.h.tpl -
#ifndef <?php echo strtoupper( $this->_dg->linuxGet()->moduleNameGet() ); ?>API_H #define <?php echo strtoupper( $this->_dg->linuxGet()->moduleNameGet() ); ?>API_H // Maximum number of devices support #define <?php echo strtoupper( $this->_dg->linuxGet()->moduleNameGet() ); ?>_DEVICES 16 // Driver name #define <?php echo strtoupper( $this->_dg->linuxGet()->moduleNameGet() ); ?>_DRIVER_NAME "<?php echo strtoupper( $this->_dg->linuxGet()->moduleNameGet() ); ?>" // Driver version #define <?php echo strtoupper( $this->_dg->linuxGet()->moduleNameGet() ); ?>_DRIVER_VERSION "v0.0.1-development"
This could be improved by exporting a variable before executing the template -
$MODULE_NAME = strtoupper( $this->_dg->linuxGet()->moduleNameGet() );
And the template would be a little more tidy:
#ifndef <?php echo $MODULE_NAME; ?>API_H #define <?php echo $MODULE_NAME; ?>API_H // Maximum number of devices support #define <?php echo $MODULE_NAME; ?>_DEVICES 16 // Driver name #define <?php echo $MODULE_NAME; ?>_DRIVER_NAME "<?php echo $MODULE_NAME; ?>" // Driver version #define <?php echo $MODULE_NAME; ?>_DRIVER_VERSION "v0.0.1-development"
#2 Updated by John Diamond almost 3 years ago
- Assignee set to Elliott McCrory
#3 Updated by Elliott McCrory almost 3 years ago
- % Done changed from 0 to 90
Ready for verification that this task is completed.