[Mediawiki-l] substitution problem?

Joe Giordano joe_giordano at yahoo.com
Sat Nov 18 15:09:28 UTC 2006


Hi all,

This could be a limitation, my misunderstanding, and/or improvement to the help text at http://meta.wikimedia.org/wiki/Help:Substitution  Any thoughts?

The idea was when creating a new page, one might want to create it with the following text, and have all information subst from each included template below it:

{{ subst:Create Page Skeleton|John|Jane|Sally|Susi|...etc...}}

Using a For loop inside of Create Page Skeleton, this should create a page with static content that has 4 modules on it, one for John, Jane, Sally, Susi. (If there were more parameters, it would create more modules.)

I can't seem to get subst to work on the for loop and at each level thereafter. I can get it to work without subst. (Below is the working version without subst.)

I've tried various (if not random at times) versions of optional (subst=subst:) and delayed (<noinclude>subst:</noinclude>) substitution but can't seem to make it work. Limitation or user error?

Here is an example loop without using subst:

Template:Create Page Skeleton contains:
<!-- This page was created using subst:Create Page Skeleton|A|B|C|D|...etc... -->

Welcome to our page. Here are the modules for each person:

{{ foreach/mypass1
   |{{{1|@}}}|{{{2|@}}}|{{{3|@}}}|{{{4|@}}}|{{{5|@}}}...etc...{{{150|@}}}
   |v@=
   |c=Template:Module
}}
<!-- end of template -->

Template:Module contains:
<!-- header -->{{ MyModuleHeader }}<!-- get contents page -->{{ {{FULLPAGENAME}}/{{{1}}} }}<!-- footer -->{{ MyModuleFooter }}
<!-- end of template -->

Template:foreach/mypass1 contains something like:
<!--
-->{{{{{{{{v{{{1|}}}|c}}}|x0}}}|1={{{1}}}}}<!--
-->{{{{{{{{v{{{2|}}}|c}}}|x0}}}|1={{{2}}}}}<!--
-->{{{{{{{{v{{{3|}}}|c}}}|x0}}}|1={{{3}}}}}<!--
-->{{{{{{{{v{{{4|}}}|c}}}|x0}}}|1={{{4}}}}}<!--
-->{{{{{{{{v{{{5|}}}|c}}}|x0}}}|1={{{5}}}}}<!--
etc...
-->{{{{{{{{v{{{150|}}}|c}}}|x0}}}|1={{{150}}}}}
<!-- end of template -->

Template:x0 is empty

Should the above example be able to work with delayed subst at all levels? The goal was to support (with simple top-level construct) user-created pages with a variable number of specified modules under it.  Thanks.


 
____________________________________________________________________________________
Sponsored Link

Mortgage rates near 39yr lows. 
$510k for $1,698/mo. Calculate new payment! 
www.LowerMyBills.com/lre



More information about the MediaWiki-l mailing list