: How to transclude in MediaWiki template? I have a MediaWiki template that I want to use in other templates, but I want the first template to add <onlyinclude> tags to the other templates
I have a MediaWiki template that I want to use in other templates, but I want the first template to add <onlyinclude> tags to the other templates it gets used in.
Unfortunately these tags get processed on the first template, so they ever get included in the target template.
How can this be done?
Example:
TemplateA: content is <onlyinclude>{{{1}}}</onlyinclude>
Article1: Article 1 {{TemplateA|Hello}}
Article2: Article 2 can say {{:Article1}}
I would like this to appear as:
Article1: Article 1 content is Hello
Article2: Article 2 can say Hello
The problem is the <onlyinclude> tags get processed on TemplateA whereas I want them to get passed through to Article1 and processed on Article1 instead.
More posts by @Sent6035632
1 Comments
Sorted by latest first Latest Oldest Best
This little trick should work since the noinclude is applied on the first generation and then the onlyinclude gets only processed at the second parsing.
<only<noinclude></noinclude>include>{{{1}}}</only<noinclude></noinclude>include>
This needs to be tested (I don't have a test Mediawiki anymore) and it might not work on all Mediawiki versions.
Terms of Use Create Support ticket Your support tickets Stock Market News! © vmapp.org2024 All Rights reserved.