Template talk:Sect

Wouldn't it be possible to use this template and Template:Sec for the same if the code was changed to this?

07:03, 2 September 2012 (EDT)


 * Well, you can already accomplish what Template:Sect does with Template:Sec by leaving the first parameter empty. For example, on a page with a section called "Ocarina of Time", typing   gives the same result as   . Kinda makes me wonder if we should just get rid of Sect since it's pretty redundant.


 * About that code... What is that fourth parameter? Correct me if I'm wrong, but you're trying to make it so that if there's four parameters, it acts as Sec, and if there isn't, it acts as Sect, right? The problem is Sec doesn't always have four parameters; page title (1), section (2), and display text (3) are required, but alternate text (4) is optional.


 * Also, you would want to use #if instead of #ifexist. #ifexist is used to search for page titles and tells the template how to behave if that page does or doesn't exist on the wiki. #if tells a template how to act if a certain string is empty or not empty.

What #ifexist is for:

What #if is for:

Where is any template parameter.

I hope that made sense. If not, don't hesitate to leave me a message on my talk page. Or Abdullah's, seeing as he's the most code-savvy admin. Also worth checking out is MediaWiki's help guide on templates (see Help:Parser Functions and Help:Templates) if you haven't already. And, of course, if you knew all this already and I'm totally off the mark, then forget I said anything :P 11:26, 2 September 2012 (EDT)