Notice: We are aware that many of the Chewiki’s images are still broken. We promise: we will try our best to fix it, but we don't guarantee that the fix will be trivial.

Difference between revisions of "Help:Creating Templates"

From Chewiki Archive - YouChew: 1% Funny, 99% Hot Gas
m
m (Fixed something.)
Line 45: Line 45:
 
==Additional Info==
 
==Additional Info==
  
*Pages can be embedded just like regular templates. Just put the name of the page between <nowiki>the '{{' and '}}' brackets</nowiki> and put a colon before the title like this: <br /><br />{{:News Articles/Recentarticle}}<br /><br />and the page will embed just as it were a template.
+
*Pages can be embedded just like regular templates. Just put the name of the page between <nowiki>the '{{' and '}}' brackets</nowiki> and put a colon before the title. For example, <nowiki>{{:News Articles/Recentarticle}}</nowiki> will bring you this: <br /><br />{{:News Articles/Recentarticle}}<br /><br />and the page will embed just as it were a template.
 
*Subpages are similar to templates. To create a subpage, just do it as you would create a regular page, but put a <nowiki>/</nowiki> and the name of the subpage you want to create after the main page. Subpages can be embedded like templates too.
 
*Subpages are similar to templates. To create a subpage, just do it as you would create a regular page, but put a <nowiki>/</nowiki> and the name of the subpage you want to create after the main page. Subpages can be embedded like templates too.
 
*If you need any more help, just look up [[Wikipedia|Wikipedia/MediaWiki]] articles on templates.
 
*If you need any more help, just look up [[Wikipedia|Wikipedia/MediaWiki]] articles on templates.
 
{{stub}}
 
{{stub}}

Revision as of 09:51, 20 November 2009

So you wanna help out the Chewiki by creating a template? Templates save you time by not having to update the coding on each and every page, rather being able to change the template itself. With that in mind, here's some tips on template making.

Creating a Template and Embedding it on Pages

You can create a template in the same way you create a regular pages. Just put Template: before the name of the template you want to create.

To place a template on a page, just put {{name of your template here}} on the page you want to place it on, and it should appear there after you save the changes.

Formatting

If you want your template to be placed in a box, put this. <div class="toc" style="background: #ffc;">Hi, I'm a template. I liek to eat pie.</div>

And you'll get something similar to this.

Hi, I'm a template. I liek to eat pie.

Customize the template with whatever background color and message you need.

Programming

You can also use programming a template. If you place {{ #if: {{{test|}}} | Hey, {{{test}}} }} in your template, and when placing a template on a page you put {{templatenamehere|test=I liek pie.}}, you should get this:

Hey, I liek pie.

You can do this trick several times in one template.

Magic Words

If you place any of these codes on a page, they should yield the following results:


{{PAGENAME}} = Name of the page; in this case, Creating Templates

{{FULLPAGENAME}} = Entire name of the page including the namespace; in this case, Help:Creating Templates

{{NAMESPACE}} = The namespace of this page, which on this page is Help

{{CURRENTYEAR}} = The year it is right now: 2024

{{CURRENTMONTHNAME}} = The current month: May

{{CURRENTMONTH}} = The current month in date form: 05

Additional Info

  • Pages can be embedded just like regular templates. Just put the name of the page between the '{{' and '}}' brackets and put a colon before the title. For example, {{:News Articles/Recentarticle}} will bring you this:

    News Articles/Recentarticle

    and the page will embed just as it were a template.
  • Subpages are similar to templates. To create a subpage, just do it as you would create a regular page, but put a / and the name of the subpage you want to create after the main page. Subpages can be embedded like templates too.
  • If you need any more help, just look up Wikipedia/MediaWiki articles on templates.