When using the CommonIncludes pattern you may come across duplicated content that varies with only one or two values. This can make using includes difficult but when combined with variables, includes become even more powerful. You can parameterize included pages by declaring variables in the test page and referencing them in the included page.
First we'll include a paraterized include page without defining any varaibles.
Now we define the required variables.
We can redefine the variables and use the parameterized include again.
First we'll include a paraterized include page without defining any varaibles.
This page requires that 3 varaibles be defined before it is included.
- NUMERATOR
- DENOMINATOR
- QUOTIENT
eg.Division | ||
numerator | denominator | quotient? |
Now we define the required variables.
This page requires that 3 varaibles be defined before it is included.
- NUMERATOR
- DENOMINATOR
- QUOTIENT
eg.Division | ||
numerator | denominator | quotient? |
100 | 10 | 10 |
We can redefine the variables and use the parameterized include again.
This page requires that 3 varaibles be defined before it is included.
- NUMERATOR
- DENOMINATOR
- QUOTIENT
eg.Division | ||
numerator | denominator | quotient? |
555 | 5 | 111 |
Add Child Page to ParameterizedIncludes