From: Norman G. <no...@as...> - 2009-02-24 16:46:02
|
Dave and all, hello. On 2009 Feb 24, at 16:03, Dave Loomer wrote: > use a #foreach (from > the LoopFunctions extension) to loop through these values. So in > referencing the template: Aha. I've tried ! Narrower terms | {{#foreach:Narrower$n$|[[Narrower::{{{Narrower$n$|}}}]]}} |- ...but then I get the error '"" cannot be used as a page name in this wiki'. If I instead use {{{Narrower$n$}}}, then I get the error '"{{{Narrower$n$}}}" cannot be used as a page name in this wiki.'. This is with: {{Concept |Label=Cat |Narrower=DomesticCat,CoolCat |Narrower1=DomesticCat |Narrower2=CoolCat }} since the LoopFunctions documentation seems to require the labels to be unit-offset. How would I check if the LoopFunctions extension is in fact installed in referata? I've tried some other more obvious things, but without success. ! Narrower term | {{#if: {{{Narrower|}}} | [[Narrower::{{#replace: {{{Narrower|}}}|,|]], [[Narrower::}}]] | none}} |- ! Narrower term | {{FormatList|Narrower|{{{Narrower|}}}}} |- ! Narrower term | {{#if: {{{Narrower|}}} | [[Narrower::{{{Narrower|}}}]] | none}} |- ... where Template:FormatList is {{#if:{{{2}}}|[[{{{1}}}::{{#explode:{{{2}}}|,}}]] ; {{FormatList| {{{1}}}|{{#sub:{{{2}}}|{{#len:{{#explode:{{{2}}}|,}}}}+1}}}}|none}} But the first of these produces an error '"}}" cannot be used as a page name in this wiki' (which may be the result of a mis-parse of the end of the #if, around '[[Narrower::}}]]' ?), and the second results in an error 'Template loop detected' (what, I can't recurse?). > 2. Pass the values in a delimited list as you have tried before, but > then write your own extension to call within the Concept template > which explodes the delimited list back into individual elements and > then processes them accordingly. Do you mean here what I tried with Template:FormatList, or something more profound, involving writing a specific PHP extension (which does seem like a damn big hammer to crack what I'd have thought was a fairly small nut). Best wishes, Norman -- Norman Gray : http://nxg.me.uk Dept Physics and Astronomy, University of Leicester |