User:Phlox/experiments
From Familypedia
Category: Category:Phlox experiments
[edit] Cached values using Subst
Utility: The motivation is that you want a cached value due to the expansion limit of 2meg, but you want the cached value to refresh. The side effect of this approach is that one must perform multiple saves to see the true values percolate out.
- the template displays the text in the first operand when the page using it is included. On noinclude (save time), it does not return the first operand, discarding it. Instead, it returns a copy of itself with the second operand in the position of the first operand. The second operand is the same query.
- The first time, it subst's the value from the other field.- this is subst'd and saved as a static value. in parameter 2.
- The second save, since there is now a valid parameter 2, it does the get father on parm2, and places it in parm one. as with the first save, parameter 2 is refreshed from the other field.
- So- we are doing two subst's- one is a copy from the other field to our cache. The second subst's from our cache to the display parm.
- Templates with subst's are executed the next save, not the first save.
- save-----parm 1----------parm2
- --1--------/----------subst field
- --2---copy of parm2---subst field
- Conclusion- this is possible (rolling the values in a kind of stack, where the top in the stack is a static, and the bottom ones are to be evaluated, but it looks like that stack would have to be huge, due to the iterative nature of subst's. Also subst detects looping with info pages so a work around would have to be figured out for that. Pain. Like maybe 5 days. For what- so the user can save six times before they see the final result? No- better do the javascript way as planned.~ Phlox 05:25, 29 October 2007 (UTC)
