No edit summary |
No edit summary |
||
Line 45: | Line 45: | ||
and its not working. I think my only problem is that I'm putting the pagename of the category in wrong. I.e. its in the wrong format or something. If I substitute a mainspace page name, its working right. --[[User:Mnbvcxz3|Mnbvcxz3]] 16:26, September 25, 2009 (UTC) |
and its not working. I think my only problem is that I'm putting the pagename of the category in wrong. I.e. its in the wrong format or something. If I substitute a mainspace page name, its working right. --[[User:Mnbvcxz3|Mnbvcxz3]] 16:26, September 25, 2009 (UTC) |
||
+ | |||
+ | : Yeah, you're guessing it right. <nowiki>{{PAGENAME}}</nowiki> returns just the name of the page without the namespace while <nowiki>{{FULLPAGENAME}}</nowiki> returns the full name of the page. For example, on a page named "Category:People", <nowiki>{{PAGENAME}}</nowiki> is "People" and <nowiki>{{FULLPAGENAME}}</nowiki> is "Category:People". –[[User:koisuru|<span style="color:darkviolet">koisuru</span>]] ([[User talk:koisuru|<span style="color:royalblue">talk</span>]]) 16:41, September 26, 2009 (UTC) |
Revision as of 16:41, 26 September 2009
To contact staff directly or to report bugs, please use Special:Contact.
How do I add a template to a page without transcluding the categories into that page? I'm asking about uncyclopedia, if that helps. I asked Spang about it, and he said using the code:
{{#dpl:include=Template:Foo|reset=categories}}
in lieu of the normal template code, ie {{Foo}}
However, that appears not to be working, it doesn't show anything. Also, the old trick of placing the template in a choose command with only 1 option doesn't work either. --Mnbvcxz3 05:13, September 24, 2009 (UTC)
- Have you tried to put all you do not want to be included inside <noinclude></noinclude>? --Ciencia Al Poder (talk) -WikiDex 09:16, September 24, 2009 (UTC)
- Alternatively, everything you do want to be included between <onlyinclude></onlyinclude>.--AB 09:35, September 24, 2009 (UTC)
- That is not what I'm trying to do. Basically, I want to add a template that normally should and does add a category without adding that category. Mainly, its to prevent recursive categorization (i.e. a category containing itself) when I add a sectional template to a category page. --Mnbvcxz3 15:28, September 24, 2009 (UTC)
- Add a parameter to the template and if that parameter is specified, the category isn't included. For example, {{#if: {{{nocategory|}}} | | [[Category:Whatever]] }}. If you want the tempate to not categorize the article where it's placed, call it with a nocategory=1 parameter --Ciencia Al Poder (talk) -WikiDex 15:53, September 24, 2009 (UTC)
Depending upon where you plan to use the template a test for the NAMESPACE magicword may prove useful. viz.
{{#ifeq: {{NAMESPACE}} | User | [[Category:Members|{{PAGENAME}}]] }}
In this case the template adds the category when it is transcluded at a page in the User: namespace but does not add the category when it is transcluded in any other namespace. The example this was taken from is w:c:vsk:MediaWiki:Welcome-user-page/pushed_messages
--najevi 17:17, September 24, 2009 (UTC)
- Thanks, but is there a way to suppress the category without using parser functions in the template? Spang suggested a similar method, but he said that it would be rather bandwidth heavy to add parser functions to a template just to effect how it will transclude on one page. Basically, I would prefer if the changes to done at the page where the template is transcluded, not in the template itself. Ideally, a working version of something like Spang's suggestion of:
{{#dpl:include=Template:Foo|reset=categories}}
--Mnbvcxz3 06:18, September 25, 2009 (UTC)
- An {{#if: }} isn't expensive. But a dpl query, as you propose, is very expensive. --Ciencia Al Poder (talk) -WikiDex 14:26, September 25, 2009 (UTC)
- Thanks, right now I'm trying
{{#ifeq:{{PAGENAME}}|Category:Mario|[[Category:Useless Category]]|[[Category:Mario]]}}
from Spang's suggestion of
{{#ifeq:{{PAGENAME}}|Page name|[[category:include if match]]|[[category:include if no match]]}}
and its not working. I think my only problem is that I'm putting the pagename of the category in wrong. I.e. its in the wrong format or something. If I substitute a mainspace page name, its working right. --Mnbvcxz3 16:26, September 25, 2009 (UTC)
- Yeah, you're guessing it right. {{PAGENAME}} returns just the name of the page without the namespace while {{FULLPAGENAME}} returns the full name of the page. For example, on a page named "Category:People", {{PAGENAME}} is "People" and {{FULLPAGENAME}} is "Category:People". –koisuru (talk) 16:41, September 26, 2009 (UTC)